// 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 * as apigateway from "oci-apigateway";
import common = require("oci-common");

// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new apigateway.DeploymentClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  updateDeploymentDetails = {
		displayName: "EXAMPLE-displayName-Value",
		specification: {
			requestPolicies: {
				authentication: {
					type: "TOKEN_AUTHENTICATION",					tokenHeader: "EXAMPLE-tokenHeader-Value",
					tokenQueryParam: "EXAMPLE-tokenQueryParam-Value",
					tokenAuthScheme: "EXAMPLE-tokenAuthScheme-Value",
					maxClockSkewInSeconds: 13.072286,
					validationPolicy: {
						type: "STATIC_KEYS",						keys: [{
								format: "PEM",								key: "EXAMPLE-key-Value",
								kid: "EXAMPLE-kid-Value"

								}
								],
						additionalValidationPolicy: {
							issuers: ["EXAMPLE--Value"									],
							audiences: ["EXAMPLE--Value"									],
							verifyClaims: [{
									key: "EXAMPLE-key-Value",
									values: ["EXAMPLE--Value"											],
									isRequired: true,

									}
									],

							}


						}
,
					validationFailurePolicy: {
						type: "MODIFY_RESPONSE",						responseCode: "EXAMPLE-responseCode-Value",
						responseMessage: "EXAMPLE-responseMessage-Value",
						responseHeaderTransformations: {
							setHeaders: {
								items: [{
										name: "EXAMPLE-name-Value",
										values: ["EXAMPLE--Value"												],
										ifExists: apigateway.models.SetHeaderPolicyItem.IfExists.Skip,

										}
										],

								}
,
							renameHeaders: {
								items: [{
										from: "EXAMPLE-from-Value",
										to: "EXAMPLE-to-Value",

										}
										],

								}
,
							filterHeaders: {
								type: apigateway.models.FilterHeaderPolicy.Type.Allow,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

							}


						}
,
					isAnonymousAccessAllowed: true

					}
,
				rateLimiting: {
					rateInRequestsPerSecond: 796,
					rateKey: apigateway.models.RateLimitingPolicy.RateKey.Total,

					}
,
				cors: {
					allowedOrigins: ["EXAMPLE--Value"							],
					allowedMethods: ["EXAMPLE--Value"							],
					allowedHeaders: ["EXAMPLE--Value"							],
					exposedHeaders: ["EXAMPLE--Value"							],
					isAllowCredentialsEnabled: true,
					maxAgeInSeconds: 268,

					}
,
				mutualTls: {
					isVerifiedCertificateRequired: true,
					allowedSans: ["EXAMPLE--Value"							],

					}
,
				usagePlans: {
					tokenLocations: ["EXAMPLE--Value"							],

					}
,
				dynamicAuthentication: {
					selectionSource: {
						type: "SINGLE",						selector: "EXAMPLE-selector-Value"

						}
,
					authenticationServers: [{
							key: {
								type: "ANY_OF",								values: ["EXAMPLE--Value"										],
								isDefault: false,
								name: "EXAMPLE-name-Value"

								}
,
							authenticationServerDetail: {
								type: "JWT_AUTHENTICATION",								tokenHeader: "EXAMPLE-tokenHeader-Value",
								tokenQueryParam: "EXAMPLE-tokenQueryParam-Value",
								tokenAuthScheme: "EXAMPLE-tokenAuthScheme-Value",
								maxClockSkewInSeconds: 89.84773,
								issuers: ["EXAMPLE--Value"										],
								audiences: ["EXAMPLE--Value"										],
								verifyClaims: [{
										key: "EXAMPLE-key-Value",
										values: ["EXAMPLE--Value"												],
										isRequired: false,

										}
										],
								publicKeys: {
									type: "REMOTE_JWKS",									uri: "EXAMPLE-uri-Value",
									isSslVerifyDisabled: true,
									maxCacheDurationInHours: 5

									}
,
								isAnonymousAccessAllowed: false

								}
,

							}
							],

					}
,

				}
,
			loggingPolicies: {
				accessLog: {
					isEnabled: false,

					}
,
				executionLog: {
					isEnabled: true,
					logLevel: apigateway.models.ExecutionLogPolicy.LogLevel.Warn,

					}
,

				}
,
			routes: [{
					path: "EXAMPLE-path-Value",
					methods: [apigateway.models.ApiSpecificationRoute.Methods.Head							],
					requestPolicies: {
						authorization: {
							type: "ANONYMOUS",
							}
,
						cors: {
							allowedOrigins: ["EXAMPLE--Value"									],
							allowedMethods: ["EXAMPLE--Value"									],
							allowedHeaders: ["EXAMPLE--Value"									],
							exposedHeaders: ["EXAMPLE--Value"									],
							isAllowCredentialsEnabled: false,
							maxAgeInSeconds: 343,

							}
,
						queryParameterValidations: {
							parameters: [{
									required: true,
									name: "EXAMPLE-name-Value",

									}
									],
							validationMode: apigateway.models.QueryParameterValidationRequestPolicy.ValidationMode.Permissive,

							}
,
						headerValidations: {
							headers: [{
									required: false,
									name: "EXAMPLE-name-Value",

									}
									],
							validationMode: apigateway.models.HeaderValidationRequestPolicy.ValidationMode.Disabled,

							}
,
						bodyValidation: {
							required: true,
							content: {
								EXAMPLE_KEY_LfkHC :{
									validationType: "NONE",
									}

								},
							validationMode: apigateway.models.BodyValidationRequestPolicy.ValidationMode.Disabled,

							}
,
						headerTransformations: {
							setHeaders: {
								items: [{
										name: "EXAMPLE-name-Value",
										values: ["EXAMPLE--Value"												],
										ifExists: apigateway.models.SetHeaderPolicyItem.IfExists.Overwrite,

										}
										],

								}
,
							renameHeaders: {
								items: [{
										from: "EXAMPLE-from-Value",
										to: "EXAMPLE-to-Value",

										}
										],

								}
,
							filterHeaders: {
								type: apigateway.models.FilterHeaderPolicy.Type.Block,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

							}
,
						queryParameterTransformations: {
							setQueryParameters: {
								items: [{
										name: "EXAMPLE-name-Value",
										values: ["EXAMPLE--Value"												],
										ifExists: apigateway.models.SetQueryParameterPolicyItem.IfExists.Overwrite,

										}
										],

								}
,
							renameQueryParameters: {
								items: [{
										from: "EXAMPLE-from-Value",
										to: "EXAMPLE-to-Value",

										}
										],

								}
,
							filterQueryParameters: {
								type: apigateway.models.FilterQueryParameterPolicy.Type.Block,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

							}
,
						responseCacheLookup: {
							type: "SIMPLE_LOOKUP_POLICY",							cacheKeyAdditions: ["EXAMPLE--Value"									],
							isEnabled: false,
							isPrivateCachingEnabled: true

							}
,

						}
,
					responsePolicies: {
						headerTransformations: {
							setHeaders: {
								items: [{
										name: "EXAMPLE-name-Value",
										values: ["EXAMPLE--Value"												],
										ifExists: apigateway.models.SetHeaderPolicyItem.IfExists.Overwrite,

										}
										],

								}
,
							renameHeaders: {
								items: [{
										from: "EXAMPLE-from-Value",
										to: "EXAMPLE-to-Value",

										}
										],

								}
,
							filterHeaders: {
								type: apigateway.models.FilterHeaderPolicy.Type.Block,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

							}
,
						responseCacheStore: {
							type: "FIXED_TTL_STORE_POLICY",							timeToLiveInSeconds: 181

							}
,

						}
,
					loggingPolicies: {
						accessLog: {
							isEnabled: false,

							}
,
						executionLog: {
							isEnabled: false,
							logLevel: apigateway.models.ExecutionLogPolicy.LogLevel.Info,

							}
,

						}
,
					backend: {
						type: "DYNAMIC_ROUTING_BACKEND",						selectionSource: {
							type: "SINGLE",							selector: "EXAMPLE-selector-Value"

							}
,
						routingBackends: [{
								key: {
									type: "WILDCARD",									expression: "EXAMPLE-expression-Value",
									isDefault: false,
									name: "EXAMPLE-name-Value"

									}
,

								}
								]

						}
,

					}
					],

			}
,
		freeformTags: {
			EXAMPLE_KEY_RWphZ :"EXAMPLE_VALUE_i4yGvwhsM6oyRo0srcYN"
			},
		definedTags: {
			EXAMPLE_KEY_Z7vSl :{
				EXAMPLE_KEY_nMifE :"EXAMPLE--Value"
				}
			},

		}

	const updateDeploymentRequest: apigateway.requests.UpdateDeploymentRequest = { 
	deploymentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentId-Value",
	updateDeploymentDetails: updateDeploymentDetails,
	ifMatch: "EXAMPLE-ifMatch-Value",
	opcRequestId: "UZXZSHBODH2V2REJ5XC3<unique_ID>",
	isLockOverride: false,

		}; 


     // Send request to the Client.
     const updateDeploymentResponse = await client.updateDeployment(updateDeploymentRequest);
     }
     catch (error) {
         console.log("updateDeployment Failed with error  " + error);
     }
})();