# 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
update_deployment_response = apigateway_client.update_deployment(
    deployment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentId-Value",
    update_deployment_details=oci.apigateway.models.UpdateDeploymentDetails(
        display_name="EXAMPLE-displayName-Value",
        specification=oci.apigateway.models.ApiSpecification(
            request_policies=oci.apigateway.models.ApiSpecificationRequestPolicies(
                authentication=oci.apigateway.models.CustomAuthenticationPolicy(
                    type="CUSTOM_AUTHENTICATION",
                    function_id="ocid1.test.oc1..<unique_ID>EXAMPLE-functionId-Value",
                    is_anonymous_access_allowed=True,
                    token_header="EXAMPLE-tokenHeader-Value",
                    token_query_param="EXAMPLE-tokenQueryParam-Value",
                    parameters={
                        'EXAMPLE_KEY_MVKN0': 'EXAMPLE_VALUE_L3tx7xtEYWKdpO0SvsBh'},
                    cache_key=["EXAMPLE--Value"],
                    validation_failure_policy=oci.apigateway.models.OAuth2ResponseValidationFailurePolicy(
                        type="OAUTH2",
                        client_details=oci.apigateway.models.ValidationBlockClientAppDetails(
                            type="VALIDATION_BLOCK"),
                        source_uri_details=oci.apigateway.models.DiscoveryUriSourceUriDetails(
                            type="DISCOVERY_URI",
                            uri="EXAMPLE-uri-Value"),
                        scopes=["EXAMPLE--Value"],
                        response_type="CODE",
                        max_expiry_duration_in_hours=17,
                        use_cookies_for_session=False,
                        use_cookies_for_intermediate_steps=True,
                        use_pkce=False,
                        fallback_redirect_path="EXAMPLE-fallbackRedirectPath-Value",
                        logout_path="EXAMPLE-logoutPath-Value")),
                rate_limiting=oci.apigateway.models.RateLimitingPolicy(
                    rate_in_requests_per_second=454,
                    rate_key="TOTAL"),
                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=514),
                mutual_tls=oci.apigateway.models.MutualTlsDetails(
                    is_verified_certificate_required=True,
                    allowed_sans=["EXAMPLE--Value"]),
                usage_plans=oci.apigateway.models.UsagePlansPolicy(
                    token_locations=["EXAMPLE--Value"]),
                dynamic_authentication=oci.apigateway.models.DynamicAuthenticationPolicy(
                    selection_source=oci.apigateway.models.SingleSelectionSourcePolicy(
                        type="SINGLE",
                        selector="EXAMPLE-selector-Value"),
                    authentication_servers=[
                        oci.apigateway.models.AuthenticationServerPolicy(
                            key=oci.apigateway.models.AnyOfSelectionKey(
                                type="ANY_OF",
                                name="EXAMPLE-name-Value",
                                is_default=False,
                                values=["EXAMPLE--Value"]),
                            authentication_server_detail=oci.apigateway.models.TokenAuthenticationPolicy(
                                type="TOKEN_AUTHENTICATION",
                                validation_policy=oci.apigateway.models.TokenAuthenticationRemoteJWKSValidationPolicy(
                                    type="REMOTE_JWKS",
                                    uri="EXAMPLE-uri-Value",
                                    additional_validation_policy=oci.apigateway.models.AdditionalValidationPolicy(
                                        issuers=["EXAMPLE--Value"],
                                        audiences=["EXAMPLE--Value"],
                                        verify_claims=[
                                            oci.apigateway.models.JsonWebTokenClaim(
                                                key="EXAMPLE-key-Value",
                                                values=["EXAMPLE--Value"],
                                                is_required=False)]),
                                    is_ssl_verify_disabled=True,
                                    max_cache_duration_in_hours=23),
                                is_anonymous_access_allowed=False,
                                token_header="EXAMPLE-tokenHeader-Value",
                                token_query_param="EXAMPLE-tokenQueryParam-Value",
                                token_auth_scheme="EXAMPLE-tokenAuthScheme-Value",
                                max_clock_skew_in_seconds=50.793236,
                                validation_failure_policy=oci.apigateway.models.ModifyResponseValidationFailurePolicy(
                                    type="MODIFY_RESPONSE",
                                    response_code="EXAMPLE-responseCode-Value",
                                    response_message="EXAMPLE-responseMessage-Value",
                                    response_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="APPEND")]),
                                        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")])))))])),
            logging_policies=oci.apigateway.models.ApiSpecificationLoggingPolicies(
                access_log=oci.apigateway.models.AccessLogPolicy(
                    is_enabled=False),
                execution_log=oci.apigateway.models.ExecutionLogPolicy(
                    is_enabled=False,
                    log_level="ERROR")),
            routes=[
                oci.apigateway.models.ApiSpecificationRoute(
                    path="EXAMPLE-path-Value",
                    backend=oci.apigateway.models.OAuth2LogoutBackend(
                        type="OAUTH2_LOGOUT_BACKEND",
                        allowed_post_logout_uris=["EXAMPLE--Value"],
                        post_logout_state="EXAMPLE-postLogoutState-Value"),
                    methods=["POST"],
                    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=856),
                        query_parameter_validations=oci.apigateway.models.QueryParameterValidationRequestPolicy(
                            parameters=[
                                oci.apigateway.models.QueryParameterValidationItem(
                                    name="EXAMPLE-name-Value",
                                    required=False)],
                            validation_mode="PERMISSIVE"),
                        header_validations=oci.apigateway.models.HeaderValidationRequestPolicy(
                            headers=[
                                oci.apigateway.models.HeaderValidationItem(
                                    name="EXAMPLE-name-Value",
                                    required=True)],
                            validation_mode="DISABLED"),
                        body_validation=oci.apigateway.models.BodyValidationRequestPolicy(
                            content={
                                'EXAMPLE_KEY_w9XBs': {
                                    'validationType': 'NONE'}},
                            required=False,
                            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="APPEND")]),
                            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="OVERWRITE")]),
                            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="ALLOW",
                                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=False,
                            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=248)),
                    logging_policies=oci.apigateway.models.ApiSpecificationLoggingPolicies(
                        access_log=oci.apigateway.models.AccessLogPolicy(
                            is_enabled=True),
                        execution_log=oci.apigateway.models.ExecutionLogPolicy(
                            is_enabled=False,
                            log_level="ERROR")))]),
        freeform_tags={
            'EXAMPLE_KEY_ewh3K': 'EXAMPLE_VALUE_EbDv00pO8rfub5qsujqn'},
        defined_tags={
            'EXAMPLE_KEY_eBItT': {
                'EXAMPLE_KEY_dcjzk': 'EXAMPLE--Value'}}),
    if_match="EXAMPLE-ifMatch-Value",
    opc_request_id="3PI5EJ3ZFWBIEZOHKCIR<unique_ID>")

# Get the data from response
print(update_deployment_response.headers)

Was this article helpful?