# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins
import copy
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities
from . import outputs

__all__ = [
    'GetUpstreamResult',
    'AwaitableGetUpstreamResult',
    'get_upstream',
    'get_upstream_output',
]

@pulumi.output_type
class GetUpstreamResult:
    """
    A collection of values returned by getUpstream.
    """
    def __init__(__self__, backend_targets=None, circuit_breaking_settings=None, comments=None, created_time=None, gateway_id=None, id=None, load_balancer_settings=None, name=None, protocol=None, source_type=None, tls_settings=None, updated_time=None, upstream_id=None, upstream_spec=None, version_details=None):
        if backend_targets and not isinstance(backend_targets, list):
            raise TypeError("Expected argument 'backend_targets' to be a list")
        pulumi.set(__self__, "backend_targets", backend_targets)
        if circuit_breaking_settings and not isinstance(circuit_breaking_settings, dict):
            raise TypeError("Expected argument 'circuit_breaking_settings' to be a dict")
        pulumi.set(__self__, "circuit_breaking_settings", circuit_breaking_settings)
        if comments and not isinstance(comments, str):
            raise TypeError("Expected argument 'comments' to be a str")
        pulumi.set(__self__, "comments", comments)
        if created_time and not isinstance(created_time, str):
            raise TypeError("Expected argument 'created_time' to be a str")
        pulumi.set(__self__, "created_time", created_time)
        if gateway_id and not isinstance(gateway_id, str):
            raise TypeError("Expected argument 'gateway_id' to be a str")
        pulumi.set(__self__, "gateway_id", gateway_id)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if load_balancer_settings and not isinstance(load_balancer_settings, dict):
            raise TypeError("Expected argument 'load_balancer_settings' to be a dict")
        pulumi.set(__self__, "load_balancer_settings", load_balancer_settings)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if protocol and not isinstance(protocol, str):
            raise TypeError("Expected argument 'protocol' to be a str")
        pulumi.set(__self__, "protocol", protocol)
        if source_type and not isinstance(source_type, str):
            raise TypeError("Expected argument 'source_type' to be a str")
        pulumi.set(__self__, "source_type", source_type)
        if tls_settings and not isinstance(tls_settings, dict):
            raise TypeError("Expected argument 'tls_settings' to be a dict")
        pulumi.set(__self__, "tls_settings", tls_settings)
        if updated_time and not isinstance(updated_time, str):
            raise TypeError("Expected argument 'updated_time' to be a str")
        pulumi.set(__self__, "updated_time", updated_time)
        if upstream_id and not isinstance(upstream_id, str):
            raise TypeError("Expected argument 'upstream_id' to be a str")
        pulumi.set(__self__, "upstream_id", upstream_id)
        if upstream_spec and not isinstance(upstream_spec, dict):
            raise TypeError("Expected argument 'upstream_spec' to be a dict")
        pulumi.set(__self__, "upstream_spec", upstream_spec)
        if version_details and not isinstance(version_details, list):
            raise TypeError("Expected argument 'version_details' to be a list")
        pulumi.set(__self__, "version_details", version_details)

    @property
    @pulumi.getter(name="backendTargets")
    def backend_targets(self) -> Sequence['outputs.GetUpstreamBackendTargetResult']:
        """
        后端节点，Upstream来源类型为VeFaas时无效。
        """
        return pulumi.get(self, "backend_targets")

    @property
    @pulumi.getter(name="circuitBreakingSettings")
    def circuit_breaking_settings(self) -> 'outputs.GetUpstreamCircuitBreakingSettingsResult':
        """
        服务熔断配置。
        """
        return pulumi.get(self, "circuit_breaking_settings")

    @property
    @pulumi.getter
    def comments(self) -> builtins.str:
        """
        备注。
        """
        return pulumi.get(self, "comments")

    @property
    @pulumi.getter(name="createdTime")
    def created_time(self) -> builtins.str:
        """
        Upstream创建时间。
        """
        return pulumi.get(self, "created_time")

    @property
    @pulumi.getter(name="gatewayId")
    def gateway_id(self) -> builtins.str:
        """
        网关实例ID。
        """
        return pulumi.get(self, "gateway_id")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="loadBalancerSettings")
    def load_balancer_settings(self) -> 'outputs.GetUpstreamLoadBalancerSettingsResult':
        """
        负载均衡配置。
        """
        return pulumi.get(self, "load_balancer_settings")

    @property
    @pulumi.getter
    def name(self) -> builtins.str:
        """
        Upstream名称。
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def protocol(self) -> builtins.str:
        """
        协议，取值：HTTP：HTTP/1.1。HTTP2：HTTP/2。GRPC：GRPC。
        """
        return pulumi.get(self, "protocol")

    @property
    @pulumi.getter(name="sourceType")
    def source_type(self) -> builtins.str:
        """
        Upstream来源类型，取值：VeFaas：函数服务。ECS：云服务器。K8S：容器服务。Nacos：注册中心。AIProvider：AI模型代理。
        """
        return pulumi.get(self, "source_type")

    @property
    @pulumi.getter(name="tlsSettings")
    def tls_settings(self) -> 'outputs.GetUpstreamTlsSettingsResult':
        """
        TLS配置。
        """
        return pulumi.get(self, "tls_settings")

    @property
    @pulumi.getter(name="updatedTime")
    def updated_time(self) -> builtins.str:
        """
        Upstream更新时间。
        """
        return pulumi.get(self, "updated_time")

    @property
    @pulumi.getter(name="upstreamId")
    def upstream_id(self) -> builtins.str:
        """
        Upstream ID。
        """
        return pulumi.get(self, "upstream_id")

    @property
    @pulumi.getter(name="upstreamSpec")
    def upstream_spec(self) -> 'outputs.GetUpstreamUpstreamSpecResult':
        """
        Upstream配置。
        """
        return pulumi.get(self, "upstream_spec")

    @property
    @pulumi.getter(name="versionDetails")
    def version_details(self) -> Sequence['outputs.GetUpstreamVersionDetailResult']:
        """
        Upstream版本，仅在Upstream来源类型为K8S时有效。
        """
        return pulumi.get(self, "version_details")


class AwaitableGetUpstreamResult(GetUpstreamResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetUpstreamResult(
            backend_targets=self.backend_targets,
            circuit_breaking_settings=self.circuit_breaking_settings,
            comments=self.comments,
            created_time=self.created_time,
            gateway_id=self.gateway_id,
            id=self.id,
            load_balancer_settings=self.load_balancer_settings,
            name=self.name,
            protocol=self.protocol,
            source_type=self.source_type,
            tls_settings=self.tls_settings,
            updated_time=self.updated_time,
            upstream_id=self.upstream_id,
            upstream_spec=self.upstream_spec,
            version_details=self.version_details)


def get_upstream(id: Optional[builtins.str] = None,
                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetUpstreamResult:
    """
    Data Source schema for Byteplus::APIG::Upstream


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:apig/getUpstream:getUpstream', __args__, opts=opts, typ=GetUpstreamResult).value

    return AwaitableGetUpstreamResult(
        backend_targets=pulumi.get(__ret__, 'backend_targets'),
        circuit_breaking_settings=pulumi.get(__ret__, 'circuit_breaking_settings'),
        comments=pulumi.get(__ret__, 'comments'),
        created_time=pulumi.get(__ret__, 'created_time'),
        gateway_id=pulumi.get(__ret__, 'gateway_id'),
        id=pulumi.get(__ret__, 'id'),
        load_balancer_settings=pulumi.get(__ret__, 'load_balancer_settings'),
        name=pulumi.get(__ret__, 'name'),
        protocol=pulumi.get(__ret__, 'protocol'),
        source_type=pulumi.get(__ret__, 'source_type'),
        tls_settings=pulumi.get(__ret__, 'tls_settings'),
        updated_time=pulumi.get(__ret__, 'updated_time'),
        upstream_id=pulumi.get(__ret__, 'upstream_id'),
        upstream_spec=pulumi.get(__ret__, 'upstream_spec'),
        version_details=pulumi.get(__ret__, 'version_details'))
def get_upstream_output(id: Optional[pulumi.Input[builtins.str]] = None,
                        opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetUpstreamResult]:
    """
    Data Source schema for Byteplus::APIG::Upstream


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:apig/getUpstream:getUpstream', __args__, opts=opts, typ=GetUpstreamResult)
    return __ret__.apply(lambda __response__: GetUpstreamResult(
        backend_targets=pulumi.get(__response__, 'backend_targets'),
        circuit_breaking_settings=pulumi.get(__response__, 'circuit_breaking_settings'),
        comments=pulumi.get(__response__, 'comments'),
        created_time=pulumi.get(__response__, 'created_time'),
        gateway_id=pulumi.get(__response__, 'gateway_id'),
        id=pulumi.get(__response__, 'id'),
        load_balancer_settings=pulumi.get(__response__, 'load_balancer_settings'),
        name=pulumi.get(__response__, 'name'),
        protocol=pulumi.get(__response__, 'protocol'),
        source_type=pulumi.get(__response__, 'source_type'),
        tls_settings=pulumi.get(__response__, 'tls_settings'),
        updated_time=pulumi.get(__response__, 'updated_time'),
        upstream_id=pulumi.get(__response__, 'upstream_id'),
        upstream_spec=pulumi.get(__response__, 'upstream_spec'),
        version_details=pulumi.get(__response__, 'version_details')))
