# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

import oci

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
apigateway_client = oci.apigateway.DeploymentClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_deployment_response = apigateway_client.create_deployment(
    create_deployment_details=oci.apigateway.models.CreateDeploymentDetails(
        gateway_id="ocid1.test.oc1..<unique_ID>EXAMPLE-gatewayId-Value",
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        path_prefix="EXAMPLE-pathPrefix-Value",
        display_name="EXAMPLE-displayName-Value",
        specification=oci.apigateway.models.ApiSpecification(
            request_policies=oci.apigateway.models.ApiSpecificationRequestPolicies(
                authentication=oci.apigateway.models.JwtAuthenticationPolicy(
                    type="JWT_AUTHENTICATION",
                    issuers=["EXAMPLE--Value"],
                    audiences=["EXAMPLE--Value"],
                    public_keys=oci.apigateway.models.StaticPublicKeySet(
                        type="STATIC_KEYS",
                        keys=[
                            oci.apigateway.models.JsonWebKey(
                                format="JSON_WEB_KEY",
                                kid="EXAMPLE-kid-Value",
                                kty="RSA",
                                alg="EXAMPLE-alg-Value",
                                n="EXAMPLE-n-Value",
                                e="EXAMPLE-e-Value",
                                use="sig",
                                key_ops=["verify"])]),
                    is_anonymous_access_allowed=True,
                    token_header="EXAMPLE-tokenHeader-Value",
                    token_query_param="EXAMPLE-tokenQueryParam-Value",
                    token_auth_scheme="EXAMPLE-tokenAuthScheme-Value",
                    verify_claims=[
                        oci.apigateway.models.JsonWebTokenClaim(
                            key="EXAMPLE-key-Value",
                            values=["EXAMPLE--Value"],
                            is_required=False)],
                    max_clock_skew_in_seconds=99.52205),
                rate_limiting=oci.apigateway.models.RateLimitingPolicy(
                    rate_in_requests_per_second=258,
                    rate_key="CLIENT_IP"),
                cors=oci.apigateway.models.CorsPolicy(
                    allowed_origins=["EXAMPLE--Value"],
                    allowed_methods=["EXAMPLE--Value"],
                    allowed_headers=["EXAMPLE--Value"],
                    exposed_headers=["EXAMPLE--Value"],
                    is_allow_credentials_enabled=True,
                    max_age_in_seconds=608)),
            logging_policies=oci.apigateway.models.ApiSpecificationLoggingPolicies(
                access_log=oci.apigateway.models.AccessLogPolicy(
                    is_enabled=False),
                execution_log=oci.apigateway.models.ExecutionLogPolicy(
                    is_enabled=True,
                    log_level="WARN")),
            routes=[
                oci.apigateway.models.ApiSpecificationRoute(
                    path="EXAMPLE-path-Value",
                    backend=oci.apigateway.models.OracleFunctionBackend(
                        type="ORACLE_FUNCTIONS_BACKEND",
                        function_id="ocid1.test.oc1..<unique_ID>EXAMPLE-functionId-Value"),
                    methods=["PUT"],
                    request_policies=oci.apigateway.models.ApiSpecificationRouteRequestPolicies(
                        authorization=oci.apigateway.models.AuthenticationOnlyRouteAuthorizationPolicy(
                            type="AUTHENTICATION_ONLY"),
                        cors=oci.apigateway.models.CorsPolicy(
                            allowed_origins=["EXAMPLE--Value"],
                            allowed_methods=["EXAMPLE--Value"],
                            allowed_headers=["EXAMPLE--Value"],
                            exposed_headers=["EXAMPLE--Value"],
                            is_allow_credentials_enabled=False,
                            max_age_in_seconds=741),
                        query_parameter_validations=oci.apigateway.models.QueryParameterValidationRequestPolicy(
                            parameters=[
                                oci.apigateway.models.QueryParameterValidationItem(
                                    name="EXAMPLE-name-Value",
                                    required=True)],
                            validation_mode="ENFORCING"),
                        header_validations=oci.apigateway.models.HeaderValidationRequestPolicy(
                            headers=[
                                oci.apigateway.models.HeaderValidationItem(
                                    name="EXAMPLE-name-Value",
                                    required=False)],
                            validation_mode="DISABLED"),
                        body_validation=oci.apigateway.models.BodyValidationRequestPolicy(
                            content={
                                'EXAMPLE_KEY_Wt8pt': {
                                    'validationType': 'NONE'}},
                            required=True,
                            validation_mode="DISABLED"),
                        header_transformations=oci.apigateway.models.HeaderTransformationPolicy(
                            set_headers=oci.apigateway.models.SetHeaderPolicy(
                                items=[
                                    oci.apigateway.models.SetHeaderPolicyItem(
                                        name="EXAMPLE-name-Value",
                                        values=["EXAMPLE--Value"],
                                        if_exists="OVERWRITE")]),
                            rename_headers=oci.apigateway.models.RenameHeaderPolicy(
                                items=[
                                    oci.apigateway.models.RenameHeaderPolicyItem(
                                        _from="EXAMPLE-from-Value",
                                        to="EXAMPLE-to-Value")]),
                            filter_headers=oci.apigateway.models.FilterHeaderPolicy(
                                type="ALLOW",
                                items=[
                                    oci.apigateway.models.FilterHeaderPolicyItem(
                                        name="EXAMPLE-name-Value")])),
                        query_parameter_transformations=oci.apigateway.models.QueryParameterTransformationPolicy(
                            set_query_parameters=oci.apigateway.models.SetQueryParameterPolicy(
                                items=[
                                    oci.apigateway.models.SetQueryParameterPolicyItem(
                                        name="EXAMPLE-name-Value",
                                        values=["EXAMPLE--Value"],
                                        if_exists="APPEND")]),
                            rename_query_parameters=oci.apigateway.models.RenameQueryParameterPolicy(
                                items=[
                                    oci.apigateway.models.RenameQueryParameterPolicyItem(
                                        _from="EXAMPLE-from-Value",
                                        to="EXAMPLE-to-Value")]),
                            filter_query_parameters=oci.apigateway.models.FilterQueryParameterPolicy(
                                type="BLOCK",
                                items=[
                                    oci.apigateway.models.FilterQueryParameterPolicyItem(
                                        name="EXAMPLE-name-Value")])),
                        response_cache_lookup=oci.apigateway.models.SimpleLookupPolicy(
                            type="SIMPLE_LOOKUP_POLICY",
                            is_enabled=True,
                            is_private_caching_enabled=True,
                            cache_key_additions=["EXAMPLE--Value"])),
                    response_policies=oci.apigateway.models.ApiSpecificationRouteResponsePolicies(
                        header_transformations=oci.apigateway.models.HeaderTransformationPolicy(
                            set_headers=oci.apigateway.models.SetHeaderPolicy(
                                items=[
                                    oci.apigateway.models.SetHeaderPolicyItem(
                                        name="EXAMPLE-name-Value",
                                        values=["EXAMPLE--Value"],
                                        if_exists="SKIP")]),
                            rename_headers=oci.apigateway.models.RenameHeaderPolicy(
                                items=[
                                    oci.apigateway.models.RenameHeaderPolicyItem(
                                        _from="EXAMPLE-from-Value",
                                        to="EXAMPLE-to-Value")]),
                            filter_headers=oci.apigateway.models.FilterHeaderPolicy(
                                type="BLOCK",
                                items=[
                                    oci.apigateway.models.FilterHeaderPolicyItem(
                                        name="EXAMPLE-name-Value")])),
                        response_cache_store=oci.apigateway.models.FixedTTLResponseCacheStorePolicy(
                            type="FIXED_TTL_STORE_POLICY",
                            time_to_live_in_seconds=985)),
                    logging_policies=oci.apigateway.models.ApiSpecificationLoggingPolicies(
                        access_log=oci.apigateway.models.AccessLogPolicy(
                            is_enabled=False),
                        execution_log=oci.apigateway.models.ExecutionLogPolicy(
                            is_enabled=True,
                            log_level="WARN")))]),
        freeform_tags={
            'EXAMPLE_KEY_hbwLX': 'EXAMPLE_VALUE_LWjVyd7srtkGQhX0jc5O'},
        defined_tags={
            'EXAMPLE_KEY_Iv5cb': {
                'EXAMPLE_KEY_TAhgy': 'EXAMPLE--Value'}}),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="HV5JBOZ1HQO5CSTEDGMD<unique_ID>")

# Get the data from response
print(create_deployment_response.data)