// 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  createDeploymentDetails = {
		displayName: "EXAMPLE-displayName-Value",
		gatewayId: "ocid1.test.oc1..<unique_ID>EXAMPLE-gatewayId-Value",
		compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
		pathPrefix: "EXAMPLE-pathPrefix-Value",
		specification: {
			requestPolicies: {
				authentication: {
					type: "JWT_AUTHENTICATION",					tokenHeader: "EXAMPLE-tokenHeader-Value",
					tokenQueryParam: "EXAMPLE-tokenQueryParam-Value",
					tokenAuthScheme: "EXAMPLE-tokenAuthScheme-Value",
					maxClockSkewInSeconds: 66.23184,
					issuers: ["EXAMPLE--Value"							],
					audiences: ["EXAMPLE--Value"							],
					verifyClaims: [{
							key: "EXAMPLE-key-Value",
							values: ["EXAMPLE--Value"									],
							isRequired: false,

							}
							],
					publicKeys: {
						type: "STATIC_KEYS",						keys: [{
								format: "PEM",								key: "EXAMPLE-key-Value",
								kid: "EXAMPLE-kid-Value"

								}
								]

						}
,
					isAnonymousAccessAllowed: true

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

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

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

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

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

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

								}
,
							authenticationServerDetail: {
								type: "CUSTOM_AUTHENTICATION",								functionId: "ocid1.test.oc1..<unique_ID>EXAMPLE-functionId-Value",
								tokenHeader: "EXAMPLE-tokenHeader-Value",
								tokenQueryParam: "EXAMPLE-tokenQueryParam-Value",
								parameters: {
									EXAMPLE_KEY_gqdPZ :"EXAMPLE_VALUE_syu88ILQxFc6Jtbtp6vG"
									},
								cacheKey: ["EXAMPLE--Value"										],
								validationFailurePolicy: {
									type: "OAUTH2",									clientDetails: {
										type: "CUSTOM",										clientId: "ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value",
										clientSecretId: "ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value",
										clientSecretVersionNumber: 170

										}
,
									sourceUriDetails: {
										type: "DISCOVERY_URI",										uri: "EXAMPLE-uri-Value"

										}
,
									scopes: ["EXAMPLE--Value"											],
									maxExpiryDurationInHours: 17,
									useCookiesForSession: false,
									useCookiesForIntermediateSteps: true,
									usePkce: true,
									responseType: apigateway.models.OAuth2ResponseValidationFailurePolicy.ResponseType.Code,
									fallbackRedirectPath: "EXAMPLE-fallbackRedirectPath-Value",
									logoutPath: "EXAMPLE-logoutPath-Value"

									}
,
								isAnonymousAccessAllowed: true

								}
,

							}
							],

					}
,

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

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

					}
,

				}
,
			routes: [{
					path: "EXAMPLE-path-Value",
					methods: [apigateway.models.ApiSpecificationRoute.Methods.Get							],
					requestPolicies: {
						authorization: {
							type: "ANY_OF",							allowedScope: ["EXAMPLE--Value"									]

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

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

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

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

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

							}
,
						bodyValidation: {
							required: false,
							content: {
								EXAMPLE_KEY_QLBo5 :{
									validationType: "NONE",
									}

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

							}
,
						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.Allow,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

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

										}
										],

								}
,
							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: true,
							isPrivateCachingEnabled: false

							}
,

						}
,
					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.Allow,
								items: [{
										name: "EXAMPLE-name-Value",

										}
										],

								}
,

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

							}
,

						}
,
					loggingPolicies: {
						accessLog: {
							isEnabled: true,

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

							}
,

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

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

									}
,

								}
								]

						}
,

					}
					],

			}
,
		locks: [{
				type: apigateway.models.AddResourceLockDetails.Type.Full,
				message: "EXAMPLE-message-Value",

				}
				],
		freeformTags: {
			EXAMPLE_KEY_jCBQj :"EXAMPLE_VALUE_9CrjEPbanXNN2XzPajDe"
			},
		definedTags: {
			EXAMPLE_KEY_mtDvE :{
				EXAMPLE_KEY_jwfkf :"EXAMPLE--Value"
				}
			},

		}

	const createDeploymentRequest: apigateway.requests.CreateDeploymentRequest = { 
	createDeploymentDetails: createDeploymentDetails,
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	opcRequestId: "R8CJBCMGYNKIHR4ORZXN<unique_ID>",

		}; 


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