# 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).

require '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::ConfigFileLoader.load_config

# Initialize service client with default config file
apigateway_client = OCI::Apigateway::DeploymentClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_deployment_response =
  apigateway_client.update_deployment(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentId-Value',
    OCI::Apigateway::Models::UpdateDeploymentDetails.new(
      display_name: 'EXAMPLE-displayName-Value',
      specification:
        OCI::Apigateway::Models::ApiSpecification.new(
          request_policies:
            OCI::Apigateway::Models::ApiSpecificationRequestPolicies.new(
              authentication:
                OCI::Apigateway::Models::TokenAuthenticationPolicy.new(
                  type: 'TOKEN_AUTHENTICATION',
                  validation_policy:
                    OCI::Apigateway::Models::TokenAuthenticationRemoteDiscoveryValidationPolicy
                      .new(
                      type: 'REMOTE_DISCOVERY',
                      client_details:
                        OCI::Apigateway::Models::ValidationBlockClientAppDetails
                          .new(type: 'VALIDATION_BLOCK'),
                      source_uri_details:
                        OCI::Apigateway::Models::ValidationBlockSourceUriDetails
                          .new(type: 'VALIDATION_BLOCK'),
                      additional_validation_policy:
                        OCI::Apigateway::Models::AdditionalValidationPolicy.new(
                          issuers: %w[EXAMPLE--Value],
                          audiences: %w[EXAMPLE--Value],
                          verify_claims: [
                            OCI::Apigateway::Models::JsonWebTokenClaim.new(
                              key: 'EXAMPLE-key-Value',
                              values: %w[EXAMPLE--Value],
                              is_required: true
                            )
                          ]
                        ),
                      is_ssl_verify_disabled: false,
                      max_cache_duration_in_hours: 11
                    ),
                  is_anonymous_access_allowed: true,
                  token_header: 'EXAMPLE-tokenHeader-Value',
                  token_query_param: 'EXAMPLE-tokenQueryParam-Value',
                  token_auth_scheme: 'EXAMPLE-tokenAuthScheme-Value',
                  max_clock_skew_in_seconds: 70.032196,
                  validation_failure_policy:
                    OCI::Apigateway::Models::OAuth2ResponseValidationFailurePolicy
                      .new(
                      type: 'OAUTH2',
                      client_details:
                        OCI::Apigateway::Models::CustomClientAppDetails.new(
                          type: 'CUSTOM',
                          client_id:
                            'ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value',
                          client_secret_id:
                            'ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value',
                          client_secret_version_number: 841
                        ),
                      source_uri_details:
                        OCI::Apigateway::Models::ValidationBlockSourceUriDetails
                          .new(type: 'VALIDATION_BLOCK'),
                      scopes: %w[EXAMPLE--Value],
                      response_type: 'CODE',
                      max_expiry_duration_in_hours: 3,
                      use_cookies_for_session: true,
                      use_cookies_for_intermediate_steps: false,
                      use_pkce: false,
                      fallback_redirect_path:
                        'EXAMPLE-fallbackRedirectPath-Value',
                      logout_path: 'EXAMPLE-logoutPath-Value',
                      login_path: 'EXAMPLE-loginPath-Value'
                    )
                ),
              rate_limiting:
                OCI::Apigateway::Models::RateLimitingPolicy.new(
                  rate_in_requests_per_second: 275, rate_key: 'CLIENT_IP'
                ),
              cors:
                OCI::Apigateway::Models::CorsPolicy.new(
                  allowed_origins: %w[EXAMPLE--Value],
                  allowed_methods: %w[EXAMPLE--Value],
                  allowed_headers: %w[EXAMPLE--Value],
                  exposed_headers: %w[EXAMPLE--Value],
                  is_allow_credentials_enabled: false,
                  max_age_in_seconds: 856
                ),
              mutual_tls:
                OCI::Apigateway::Models::MutualTlsDetails.new(
                  is_verified_certificate_required: true,
                  allowed_sans: %w[EXAMPLE--Value]
                ),
              usage_plans:
                OCI::Apigateway::Models::UsagePlansPolicy.new(
                  token_locations: %w[EXAMPLE--Value]
                ),
              dynamic_authentication:
                OCI::Apigateway::Models::DynamicAuthenticationPolicy.new(
                  selection_source:
                    OCI::Apigateway::Models::SingleSelectionSourcePolicy.new(
                      type: 'SINGLE', selector: 'EXAMPLE-selector-Value'
                    ),
                  authentication_servers: [
                    OCI::Apigateway::Models::AuthenticationServerPolicy.new(
                      key:
                        OCI::Apigateway::Models::AnyOfSelectionKey.new(
                          type: 'ANY_OF',
                          name: 'EXAMPLE-name-Value',
                          is_default: false,
                          values: %w[EXAMPLE--Value]
                        ),
                      authentication_server_detail:
                        OCI::Apigateway::Models::TokenAuthenticationPolicy.new(
                          type: 'TOKEN_AUTHENTICATION',
                          validation_policy:
                            OCI::Apigateway::Models::TokenAuthenticationRemoteDiscoveryValidationPolicy
                              .new(
                              type: 'REMOTE_DISCOVERY',
                              client_details:
                                OCI::Apigateway::Models::CustomClientAppDetails
                                  .new(
                                  type: 'CUSTOM',
                                  client_id:
                                    'ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value',
                                  client_secret_id:
                                    'ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value',
                                  client_secret_version_number: 777
                                ),
                              source_uri_details:
                                OCI::Apigateway::Models::DiscoveryUriSourceUriDetails
                                  .new(
                                  type: 'DISCOVERY_URI',
                                  uri: 'EXAMPLE-uri-Value'
                                ),
                              additional_validation_policy:
                                OCI::Apigateway::Models::AdditionalValidationPolicy
                                  .new(
                                  issuers: %w[EXAMPLE--Value],
                                  audiences: %w[EXAMPLE--Value],
                                  verify_claims: [
                                    OCI::Apigateway::Models::JsonWebTokenClaim
                                      .new(
                                      key: 'EXAMPLE-key-Value',
                                      values: %w[EXAMPLE--Value],
                                      is_required: true
                                    )
                                  ]
                                ),
                              is_ssl_verify_disabled: false,
                              max_cache_duration_in_hours: 7
                            ),
                          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: 103.62991,
                          validation_failure_policy:
                            OCI::Apigateway::Models::OAuth2ResponseValidationFailurePolicy
                              .new(
                              type: 'OAUTH2',
                              client_details:
                                OCI::Apigateway::Models::CustomClientAppDetails
                                  .new(
                                  type: 'CUSTOM',
                                  client_id:
                                    'ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value',
                                  client_secret_id:
                                    'ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value',
                                  client_secret_version_number: 982
                                ),
                              source_uri_details:
                                OCI::Apigateway::Models::DiscoveryUriSourceUriDetails
                                  .new(
                                  type: 'DISCOVERY_URI',
                                  uri: 'EXAMPLE-uri-Value'
                                ),
                              scopes: %w[EXAMPLE--Value],
                              response_type: 'CODE',
                              max_expiry_duration_in_hours: 5,
                              use_cookies_for_session: false,
                              use_cookies_for_intermediate_steps: false,
                              use_pkce: true,
                              fallback_redirect_path:
                                'EXAMPLE-fallbackRedirectPath-Value',
                              logout_path: 'EXAMPLE-logoutPath-Value',
                              login_path: 'EXAMPLE-loginPath-Value'
                            )
                        )
                    )
                  ]
                )
            ),
          logging_policies:
            OCI::Apigateway::Models::ApiSpecificationLoggingPolicies.new(
              access_log:
                OCI::Apigateway::Models::AccessLogPolicy.new(is_enabled: true),
              execution_log:
                OCI::Apigateway::Models::ExecutionLogPolicy.new(
                  is_enabled: true, log_level: 'ERROR'
                )
            ),
          routes: [
            OCI::Apigateway::Models::ApiSpecificationRoute.new(
              path: 'EXAMPLE-path-Value',
              backend:
                OCI::Apigateway::Models::DynamicRoutingBackend.new(
                  type: 'DYNAMIC_ROUTING_BACKEND',
                  selection_source:
                    OCI::Apigateway::Models::SingleSelectionSourcePolicy.new(
                      type: 'SINGLE', selector: 'EXAMPLE-selector-Value'
                    ),
                  routing_backends: [
                    OCI::Apigateway::Models::DynamicRoutingTypeRoutingBackend
                      .new(
                      key:
                        OCI::Apigateway::Models::WildcardSelectionKey.new(
                          type: 'WILDCARD',
                          name: 'EXAMPLE-name-Value',
                          expression: 'EXAMPLE-expression-Value',
                          is_default: true
                        )
                    )
                  ]
                ),
              methods: %w[PATCH],
              request_policies:
                OCI::Apigateway::Models::ApiSpecificationRouteRequestPolicies
                  .new(
                  authorization:
                    OCI::Apigateway::Models::AuthenticationOnlyRouteAuthorizationPolicy
                      .new(type: 'AUTHENTICATION_ONLY'),
                  cors:
                    OCI::Apigateway::Models::CorsPolicy.new(
                      allowed_origins: %w[EXAMPLE--Value],
                      allowed_methods: %w[EXAMPLE--Value],
                      allowed_headers: %w[EXAMPLE--Value],
                      exposed_headers: %w[EXAMPLE--Value],
                      is_allow_credentials_enabled: false,
                      max_age_in_seconds: 372
                    ),
                  query_parameter_validations:
                    OCI::Apigateway::Models::QueryParameterValidationRequestPolicy
                      .new(
                      parameters: [
                        OCI::Apigateway::Models::QueryParameterValidationItem
                          .new(name: 'EXAMPLE-name-Value', required: true)
                      ],
                      validation_mode: 'ENFORCING'
                    ),
                  header_validations:
                    OCI::Apigateway::Models::HeaderValidationRequestPolicy.new(
                      headers: [
                        OCI::Apigateway::Models::HeaderValidationItem.new(
                          name: 'EXAMPLE-name-Value', required: true
                        )
                      ],
                      validation_mode: 'ENFORCING'
                    ),
                  body_validation:
                    OCI::Apigateway::Models::BodyValidationRequestPolicy.new(
                      content: {
                        'EXAMPLE_KEY_MyhDk' => { 'validationType' => 'NONE' }
                      },
                      required: true,
                      validation_mode: 'PERMISSIVE'
                    ),
                  header_transformations:
                    OCI::Apigateway::Models::HeaderTransformationPolicy.new(
                      set_headers:
                        OCI::Apigateway::Models::SetHeaderPolicy.new(
                          items: [
                            OCI::Apigateway::Models::SetHeaderPolicyItem.new(
                              name: 'EXAMPLE-name-Value',
                              values: %w[EXAMPLE--Value],
                              if_exists: 'OVERWRITE'
                            )
                          ]
                        ),
                      rename_headers:
                        OCI::Apigateway::Models::RenameHeaderPolicy.new(
                          items: [
                            OCI::Apigateway::Models::RenameHeaderPolicyItem.new(
                              _from: 'EXAMPLE-from-Value',
                              to: 'EXAMPLE-to-Value'
                            )
                          ]
                        ),
                      filter_headers:
                        OCI::Apigateway::Models::FilterHeaderPolicy.new(
                          type: 'BLOCK',
                          items: [
                            OCI::Apigateway::Models::FilterHeaderPolicyItem.new(
                              name: 'EXAMPLE-name-Value'
                            )
                          ]
                        )
                    ),
                  query_parameter_transformations:
                    OCI::Apigateway::Models::QueryParameterTransformationPolicy
                      .new(
                      set_query_parameters:
                        OCI::Apigateway::Models::SetQueryParameterPolicy.new(
                          items: [
                            OCI::Apigateway::Models::SetQueryParameterPolicyItem
                              .new(
                              name: 'EXAMPLE-name-Value',
                              values: %w[EXAMPLE--Value],
                              if_exists: 'APPEND'
                            )
                          ]
                        ),
                      rename_query_parameters:
                        OCI::Apigateway::Models::RenameQueryParameterPolicy.new(
                          items: [
                            OCI::Apigateway::Models::RenameQueryParameterPolicyItem
                              .new(
                              _from: 'EXAMPLE-from-Value',
                              to: 'EXAMPLE-to-Value'
                            )
                          ]
                        ),
                      filter_query_parameters:
                        OCI::Apigateway::Models::FilterQueryParameterPolicy.new(
                          type: 'ALLOW',
                          items: [
                            OCI::Apigateway::Models::FilterQueryParameterPolicyItem
                              .new(name: 'EXAMPLE-name-Value')
                          ]
                        )
                    ),
                  response_cache_lookup:
                    OCI::Apigateway::Models::SimpleLookupPolicy.new(
                      type: 'SIMPLE_LOOKUP_POLICY',
                      is_enabled: true,
                      is_private_caching_enabled: false,
                      cache_key_additions: %w[EXAMPLE--Value]
                    )
                ),
              response_policies:
                OCI::Apigateway::Models::ApiSpecificationRouteResponsePolicies
                  .new(
                  header_transformations:
                    OCI::Apigateway::Models::HeaderTransformationPolicy.new(
                      set_headers:
                        OCI::Apigateway::Models::SetHeaderPolicy.new(
                          items: [
                            OCI::Apigateway::Models::SetHeaderPolicyItem.new(
                              name: 'EXAMPLE-name-Value',
                              values: %w[EXAMPLE--Value],
                              if_exists: 'OVERWRITE'
                            )
                          ]
                        ),
                      rename_headers:
                        OCI::Apigateway::Models::RenameHeaderPolicy.new(
                          items: [
                            OCI::Apigateway::Models::RenameHeaderPolicyItem.new(
                              _from: 'EXAMPLE-from-Value',
                              to: 'EXAMPLE-to-Value'
                            )
                          ]
                        ),
                      filter_headers:
                        OCI::Apigateway::Models::FilterHeaderPolicy.new(
                          type: 'BLOCK',
                          items: [
                            OCI::Apigateway::Models::FilterHeaderPolicyItem.new(
                              name: 'EXAMPLE-name-Value'
                            )
                          ]
                        )
                    ),
                  response_cache_store:
                    OCI::Apigateway::Models::FixedTTLResponseCacheStorePolicy
                      .new(
                      type: 'FIXED_TTL_STORE_POLICY',
                      time_to_live_in_seconds: 127
                    )
                ),
              logging_policies:
                OCI::Apigateway::Models::ApiSpecificationLoggingPolicies.new(
                  access_log:
                    OCI::Apigateway::Models::AccessLogPolicy.new(
                      is_enabled: false
                    ),
                  execution_log:
                    OCI::Apigateway::Models::ExecutionLogPolicy.new(
                      is_enabled: false, log_level: 'ERROR'
                    )
                )
            )
          ]
        ),
      freeform_tags: {
        'EXAMPLE_KEY_z6W6Z' => 'EXAMPLE_VALUE_4UBFtDpF7vm8oSIOGTAa'
      },
      defined_tags: {
        'EXAMPLE_KEY_Km3n7' => { 'EXAMPLE_KEY_MjFQq' => 'EXAMPLE--Value' }
      }
    )
  )

# Get the data from response
puts "#{update_deployment_response.headers}"