# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class BackendService(pulumi.CustomResource):
    affinity_cookie_ttl_sec: pulumi.Output[float]
    backends: pulumi.Output[list]
    cdn_policy: pulumi.Output[dict]
    circuit_breakers: pulumi.Output[dict]
    connection_draining_timeout_sec: pulumi.Output[float]
    consistent_hash: pulumi.Output[dict]
    creation_timestamp: pulumi.Output[str]
    custom_request_headers: pulumi.Output[list]
    description: pulumi.Output[str]
    enable_cdn: pulumi.Output[bool]
    fingerprint: pulumi.Output[str]
    health_checks: pulumi.Output[str]
    iap: pulumi.Output[dict]
    load_balancing_scheme: pulumi.Output[str]
    locality_lb_policy: pulumi.Output[str]
    log_config: pulumi.Output[dict]
    name: pulumi.Output[str]
    outlier_detection: pulumi.Output[dict]
    port_name: pulumi.Output[str]
    project: pulumi.Output[str]
    """
    The ID of the project in which the resource belongs.
    If it is not provided, the provider project is used.
    """
    protocol: pulumi.Output[str]
    security_policy: pulumi.Output[str]
    self_link: pulumi.Output[str]
    """
    The URI of the created resource.
    """
    session_affinity: pulumi.Output[str]
    timeout_sec: pulumi.Output[float]
    def __init__(__self__, resource_name, opts=None, affinity_cookie_ttl_sec=None, backends=None, cdn_policy=None, circuit_breakers=None, connection_draining_timeout_sec=None, consistent_hash=None, custom_request_headers=None, description=None, enable_cdn=None, health_checks=None, iap=None, load_balancing_scheme=None, locality_lb_policy=None, log_config=None, name=None, outlier_detection=None, port_name=None, project=None, protocol=None, security_policy=None, session_affinity=None, timeout_sec=None, __props__=None, __name__=None, __opts__=None):
        """
        Create a BackendService resource with the given unique name, props, and options.
        
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] project: The ID of the project in which the resource belongs.
               If it is not provided, the provider project is used.
        
        The **backends** object supports the following:
        
          * `balancingMode` (`pulumi.Input[str]`)
          * `capacityScaler` (`pulumi.Input[float]`)
          * `description` (`pulumi.Input[str]`)
          * `group` (`pulumi.Input[str]`)
          * `maxConnections` (`pulumi.Input[float]`)
          * `maxConnectionsPerEndpoint` (`pulumi.Input[float]`)
          * `maxConnectionsPerInstance` (`pulumi.Input[float]`)
          * `maxRate` (`pulumi.Input[float]`)
          * `maxRatePerEndpoint` (`pulumi.Input[float]`)
          * `maxRatePerInstance` (`pulumi.Input[float]`)
          * `maxUtilization` (`pulumi.Input[float]`)
        
        The **cdn_policy** object supports the following:
        
          * `cacheKeyPolicy` (`pulumi.Input[dict]`)
        
            * `includeHost` (`pulumi.Input[bool]`)
            * `includeProtocol` (`pulumi.Input[bool]`)
            * `includeQueryString` (`pulumi.Input[bool]`)
            * `queryStringBlacklists` (`pulumi.Input[list]`)
            * `queryStringWhitelists` (`pulumi.Input[list]`)
        
          * `signedUrlCacheMaxAgeSec` (`pulumi.Input[float]`)
        
        The **circuit_breakers** object supports the following:
        
          * `connectTimeout` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `maxConnections` (`pulumi.Input[float]`)
          * `maxPendingRequests` (`pulumi.Input[float]`)
          * `maxRequests` (`pulumi.Input[float]`)
          * `maxRequestsPerConnection` (`pulumi.Input[float]`)
          * `maxRetries` (`pulumi.Input[float]`)
        
        The **consistent_hash** object supports the following:
        
          * `httpCookie` (`pulumi.Input[dict]`)
        
            * `name` (`pulumi.Input[str]`)
            * `path` (`pulumi.Input[str]`)
            * `ttl` (`pulumi.Input[dict]`)
        
              * `nanos` (`pulumi.Input[float]`)
              * `seconds` (`pulumi.Input[float]`)
        
          * `httpHeaderName` (`pulumi.Input[str]`)
          * `minimumRingSize` (`pulumi.Input[float]`)
        
        The **iap** object supports the following:
        
          * `oauth2ClientId` (`pulumi.Input[str]`)
          * `oauth2ClientSecret` (`pulumi.Input[str]`)
          * `oauth2ClientSecretSha256` (`pulumi.Input[str]`)
        
        The **log_config** object supports the following:
        
          * `enable` (`pulumi.Input[bool]`)
          * `sampleRate` (`pulumi.Input[float]`)
        
        The **outlier_detection** object supports the following:
        
          * `baseEjectionTime` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `consecutiveErrors` (`pulumi.Input[float]`)
          * `consecutiveGatewayFailure` (`pulumi.Input[float]`)
          * `enforcingConsecutiveErrors` (`pulumi.Input[float]`)
          * `enforcingConsecutiveGatewayFailure` (`pulumi.Input[float]`)
          * `enforcingSuccessRate` (`pulumi.Input[float]`)
          * `interval` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `maxEjectionPercent` (`pulumi.Input[float]`)
          * `successRateMinimumHosts` (`pulumi.Input[float]`)
          * `successRateRequestVolume` (`pulumi.Input[float]`)
          * `successRateStdevFactor` (`pulumi.Input[float]`)

        > This content is derived from https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/r/compute_backend_service.html.markdown.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['affinity_cookie_ttl_sec'] = affinity_cookie_ttl_sec
            __props__['backends'] = backends
            __props__['cdn_policy'] = cdn_policy
            __props__['circuit_breakers'] = circuit_breakers
            __props__['connection_draining_timeout_sec'] = connection_draining_timeout_sec
            __props__['consistent_hash'] = consistent_hash
            __props__['custom_request_headers'] = custom_request_headers
            __props__['description'] = description
            __props__['enable_cdn'] = enable_cdn
            if health_checks is None:
                raise TypeError("Missing required property 'health_checks'")
            __props__['health_checks'] = health_checks
            __props__['iap'] = iap
            __props__['load_balancing_scheme'] = load_balancing_scheme
            __props__['locality_lb_policy'] = locality_lb_policy
            __props__['log_config'] = log_config
            __props__['name'] = name
            __props__['outlier_detection'] = outlier_detection
            __props__['port_name'] = port_name
            __props__['project'] = project
            __props__['protocol'] = protocol
            __props__['security_policy'] = security_policy
            __props__['session_affinity'] = session_affinity
            __props__['timeout_sec'] = timeout_sec
            __props__['creation_timestamp'] = None
            __props__['fingerprint'] = None
            __props__['self_link'] = None
        super(BackendService, __self__).__init__(
            'gcp:compute/backendService:BackendService',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, affinity_cookie_ttl_sec=None, backends=None, cdn_policy=None, circuit_breakers=None, connection_draining_timeout_sec=None, consistent_hash=None, creation_timestamp=None, custom_request_headers=None, description=None, enable_cdn=None, fingerprint=None, health_checks=None, iap=None, load_balancing_scheme=None, locality_lb_policy=None, log_config=None, name=None, outlier_detection=None, port_name=None, project=None, protocol=None, security_policy=None, self_link=None, session_affinity=None, timeout_sec=None):
        """
        Get an existing BackendService resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.
        
        :param str resource_name: The unique name of the resulting resource.
        :param str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] project: The ID of the project in which the resource belongs.
               If it is not provided, the provider project is used.
        :param pulumi.Input[str] self_link: The URI of the created resource.
        
        The **backends** object supports the following:
        
          * `balancingMode` (`pulumi.Input[str]`)
          * `capacityScaler` (`pulumi.Input[float]`)
          * `description` (`pulumi.Input[str]`)
          * `group` (`pulumi.Input[str]`)
          * `maxConnections` (`pulumi.Input[float]`)
          * `maxConnectionsPerEndpoint` (`pulumi.Input[float]`)
          * `maxConnectionsPerInstance` (`pulumi.Input[float]`)
          * `maxRate` (`pulumi.Input[float]`)
          * `maxRatePerEndpoint` (`pulumi.Input[float]`)
          * `maxRatePerInstance` (`pulumi.Input[float]`)
          * `maxUtilization` (`pulumi.Input[float]`)
        
        The **cdn_policy** object supports the following:
        
          * `cacheKeyPolicy` (`pulumi.Input[dict]`)
        
            * `includeHost` (`pulumi.Input[bool]`)
            * `includeProtocol` (`pulumi.Input[bool]`)
            * `includeQueryString` (`pulumi.Input[bool]`)
            * `queryStringBlacklists` (`pulumi.Input[list]`)
            * `queryStringWhitelists` (`pulumi.Input[list]`)
        
          * `signedUrlCacheMaxAgeSec` (`pulumi.Input[float]`)
        
        The **circuit_breakers** object supports the following:
        
          * `connectTimeout` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `maxConnections` (`pulumi.Input[float]`)
          * `maxPendingRequests` (`pulumi.Input[float]`)
          * `maxRequests` (`pulumi.Input[float]`)
          * `maxRequestsPerConnection` (`pulumi.Input[float]`)
          * `maxRetries` (`pulumi.Input[float]`)
        
        The **consistent_hash** object supports the following:
        
          * `httpCookie` (`pulumi.Input[dict]`)
        
            * `name` (`pulumi.Input[str]`)
            * `path` (`pulumi.Input[str]`)
            * `ttl` (`pulumi.Input[dict]`)
        
              * `nanos` (`pulumi.Input[float]`)
              * `seconds` (`pulumi.Input[float]`)
        
          * `httpHeaderName` (`pulumi.Input[str]`)
          * `minimumRingSize` (`pulumi.Input[float]`)
        
        The **iap** object supports the following:
        
          * `oauth2ClientId` (`pulumi.Input[str]`)
          * `oauth2ClientSecret` (`pulumi.Input[str]`)
          * `oauth2ClientSecretSha256` (`pulumi.Input[str]`)
        
        The **log_config** object supports the following:
        
          * `enable` (`pulumi.Input[bool]`)
          * `sampleRate` (`pulumi.Input[float]`)
        
        The **outlier_detection** object supports the following:
        
          * `baseEjectionTime` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `consecutiveErrors` (`pulumi.Input[float]`)
          * `consecutiveGatewayFailure` (`pulumi.Input[float]`)
          * `enforcingConsecutiveErrors` (`pulumi.Input[float]`)
          * `enforcingConsecutiveGatewayFailure` (`pulumi.Input[float]`)
          * `enforcingSuccessRate` (`pulumi.Input[float]`)
          * `interval` (`pulumi.Input[dict]`)
        
            * `nanos` (`pulumi.Input[float]`)
            * `seconds` (`pulumi.Input[float]`)
        
          * `maxEjectionPercent` (`pulumi.Input[float]`)
          * `successRateMinimumHosts` (`pulumi.Input[float]`)
          * `successRateRequestVolume` (`pulumi.Input[float]`)
          * `successRateStdevFactor` (`pulumi.Input[float]`)

        > This content is derived from https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/r/compute_backend_service.html.markdown.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()
        __props__["affinity_cookie_ttl_sec"] = affinity_cookie_ttl_sec
        __props__["backends"] = backends
        __props__["cdn_policy"] = cdn_policy
        __props__["circuit_breakers"] = circuit_breakers
        __props__["connection_draining_timeout_sec"] = connection_draining_timeout_sec
        __props__["consistent_hash"] = consistent_hash
        __props__["creation_timestamp"] = creation_timestamp
        __props__["custom_request_headers"] = custom_request_headers
        __props__["description"] = description
        __props__["enable_cdn"] = enable_cdn
        __props__["fingerprint"] = fingerprint
        __props__["health_checks"] = health_checks
        __props__["iap"] = iap
        __props__["load_balancing_scheme"] = load_balancing_scheme
        __props__["locality_lb_policy"] = locality_lb_policy
        __props__["log_config"] = log_config
        __props__["name"] = name
        __props__["outlier_detection"] = outlier_detection
        __props__["port_name"] = port_name
        __props__["project"] = project
        __props__["protocol"] = protocol
        __props__["security_policy"] = security_policy
        __props__["self_link"] = self_link
        __props__["session_affinity"] = session_affinity
        __props__["timeout_sec"] = timeout_sec
        return BackendService(resource_name, opts=opts, __props__=__props__)
    def translate_output_property(self, prop):
        return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

