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

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/apigateway"
	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateDeployment() {
	// 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.
	client, err := apigateway.NewDeploymentClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := apigateway.CreateDeploymentRequest{CreateDeploymentDetails: apigateway.CreateDeploymentDetails{PathPrefix: common.String("EXAMPLE-pathPrefix-Value"),
		Specification: &apigateway.ApiSpecification{RequestPolicies: &apigateway.ApiSpecificationRequestPolicies{Authentication: apigateway.JwtAuthenticationPolicy{PublicKeys: apigateway.StaticPublicKeySet{Keys: []apigateway.StaticPublicKey{apigateway.JsonWebKey{Kid: common.String("EXAMPLE-kid-Value"),
			Kty:    apigateway.JsonWebKeyKtyRsa,
			N:      common.String("EXAMPLE-n-Value"),
			Use:    apigateway.JsonWebKeyUseSig,
			Alg:    common.String("EXAMPLE-alg-Value"),
			E:      common.String("EXAMPLE-e-Value"),
			KeyOps: []apigateway.JsonWebKeyKeyOpsEnum{apigateway.JsonWebKeyKeyOpsVerify}}}},
			TokenHeader:              common.String("EXAMPLE-tokenHeader-Value"),
			TokenQueryParam:          common.String("EXAMPLE-tokenQueryParam-Value"),
			IsAnonymousAccessAllowed: common.Bool(true),
			MaxClockSkewInSeconds:    common.Float32(89.31392),
			TokenAuthScheme:          common.String("EXAMPLE-tokenAuthScheme-Value"),
			VerifyClaims: []apigateway.JsonWebTokenClaim{apigateway.JsonWebTokenClaim{IsRequired: common.Bool(true),
				Key:    common.String("EXAMPLE-key-Value"),
				Values: []string{"EXAMPLE--Value"}}},
			Audiences: []string{"EXAMPLE--Value"},
			Issuers:   []string{"EXAMPLE--Value"}},
			Cors: &apigateway.CorsPolicy{MaxAgeInSeconds: common.Int(111),
				AllowedHeaders:            []string{"EXAMPLE--Value"},
				AllowedMethods:            []string{"EXAMPLE--Value"},
				AllowedOrigins:            []string{"EXAMPLE--Value"},
				ExposedHeaders:            []string{"EXAMPLE--Value"},
				IsAllowCredentialsEnabled: common.Bool(false)},
			DynamicAuthentication: &apigateway.DynamicAuthenticationPolicy{AuthenticationServers: []apigateway.AuthenticationServerPolicy{apigateway.AuthenticationServerPolicy{AuthenticationServerDetail: apigateway.JwtAuthenticationPolicy{MaxClockSkewInSeconds: common.Float32(61.008404),
				TokenHeader:     common.String("EXAMPLE-tokenHeader-Value"),
				TokenQueryParam: common.String("EXAMPLE-tokenQueryParam-Value"),
				VerifyClaims: []apigateway.JsonWebTokenClaim{apigateway.JsonWebTokenClaim{IsRequired: common.Bool(true),
					Key:    common.String("EXAMPLE-key-Value"),
					Values: []string{"EXAMPLE--Value"}}},
				Audiences:                []string{"EXAMPLE--Value"},
				IsAnonymousAccessAllowed: common.Bool(true),
				Issuers:                  []string{"EXAMPLE--Value"},
				PublicKeys: apigateway.StaticPublicKeySet{Keys: []apigateway.StaticPublicKey{apigateway.PemEncodedPublicKey{Key: common.String("EXAMPLE-key-Value"),
					Kid: common.String("EXAMPLE-kid-Value")}}},
				TokenAuthScheme: common.String("EXAMPLE-tokenAuthScheme-Value")},
				Key: apigateway.WildcardSelectionKey{Name: common.String("EXAMPLE-name-Value"),
					Expression: common.String("EXAMPLE-expression-Value"),
					IsDefault:  common.Bool(false)}}},
				SelectionSource: apigateway.SingleSelectionSourcePolicy{Selector: common.String("EXAMPLE-selector-Value")}},
			MutualTls: &apigateway.MutualTlsDetails{AllowedSans: []string{"EXAMPLE--Value"},
				IsVerifiedCertificateRequired: common.Bool(false)},
			RateLimiting: &apigateway.RateLimitingPolicy{RateInRequestsPerSecond: common.Int(559),
				RateKey: apigateway.RateLimitingPolicyRateKeyClientIp},
			UsagePlans: &apigateway.UsagePlansPolicy{TokenLocations: []string{"EXAMPLE--Value"}}},
			Routes: []apigateway.ApiSpecificationRoute{apigateway.ApiSpecificationRoute{Backend: apigateway.OAuth2LogoutBackend{AllowedPostLogoutUris: []string{"EXAMPLE--Value"},
				PostLogoutState: common.String("EXAMPLE-postLogoutState-Value")},
				LoggingPolicies: &apigateway.ApiSpecificationLoggingPolicies{AccessLog: &apigateway.AccessLogPolicy{IsEnabled: common.Bool(true)},
					ExecutionLog: &apigateway.ExecutionLogPolicy{IsEnabled: common.Bool(true),
						LogLevel: apigateway.ExecutionLogPolicyLogLevelWarn}},
				Methods: []apigateway.ApiSpecificationRouteMethodsEnum{apigateway.ApiSpecificationRouteMethodsPost},
				Path:    common.String("EXAMPLE-path-Value"),
				RequestPolicies: &apigateway.ApiSpecificationRouteRequestPolicies{BodyValidation: &apigateway.BodyValidationRequestPolicy{Content: map[string]apigateway.ContentValidation{"EXAMPLE_KEY_S70Jj": apigateway.NoContentValidation{}},
					Required:       common.Bool(false),
					ValidationMode: apigateway.BodyValidationRequestPolicyValidationModeEnforcing},
					Cors: &apigateway.CorsPolicy{ExposedHeaders: []string{"EXAMPLE--Value"},
						IsAllowCredentialsEnabled: common.Bool(false),
						MaxAgeInSeconds:           common.Int(473),
						AllowedHeaders:            []string{"EXAMPLE--Value"},
						AllowedMethods:            []string{"EXAMPLE--Value"},
						AllowedOrigins:            []string{"EXAMPLE--Value"}},
					HeaderTransformations: &apigateway.HeaderTransformationPolicy{FilterHeaders: &apigateway.FilterHeaderPolicy{Items: []apigateway.FilterHeaderPolicyItem{apigateway.FilterHeaderPolicyItem{Name: common.String("EXAMPLE-name-Value")}},
						Type: apigateway.FilterHeaderPolicyTypeAllow},
						RenameHeaders: &apigateway.RenameHeaderPolicy{Items: []apigateway.RenameHeaderPolicyItem{apigateway.RenameHeaderPolicyItem{From: common.String("EXAMPLE-from-Value"),
							To: common.String("EXAMPLE-to-Value")}}},
						SetHeaders: &apigateway.SetHeaderPolicy{Items: []apigateway.SetHeaderPolicyItem{apigateway.SetHeaderPolicyItem{IfExists: apigateway.SetHeaderPolicyItemIfExistsAppend,
							Name:   common.String("EXAMPLE-name-Value"),
							Values: []string{"EXAMPLE--Value"}}}}},
					HeaderValidations: &apigateway.HeaderValidationRequestPolicy{Headers: []apigateway.HeaderValidationItem{apigateway.HeaderValidationItem{Name: common.String("EXAMPLE-name-Value"),
						Required: common.Bool(true)}},
						ValidationMode: apigateway.HeaderValidationRequestPolicyValidationModeDisabled},
					QueryParameterTransformations: &apigateway.QueryParameterTransformationPolicy{FilterQueryParameters: &apigateway.FilterQueryParameterPolicy{Items: []apigateway.FilterQueryParameterPolicyItem{apigateway.FilterQueryParameterPolicyItem{Name: common.String("EXAMPLE-name-Value")}},
						Type: apigateway.FilterQueryParameterPolicyTypeBlock},
						RenameQueryParameters: &apigateway.RenameQueryParameterPolicy{Items: []apigateway.RenameQueryParameterPolicyItem{apigateway.RenameQueryParameterPolicyItem{From: common.String("EXAMPLE-from-Value"),
							To: common.String("EXAMPLE-to-Value")}}},
						SetQueryParameters: &apigateway.SetQueryParameterPolicy{Items: []apigateway.SetQueryParameterPolicyItem{apigateway.SetQueryParameterPolicyItem{IfExists: apigateway.SetQueryParameterPolicyItemIfExistsSkip,
							Name:   common.String("EXAMPLE-name-Value"),
							Values: []string{"EXAMPLE--Value"}}}}},
					QueryParameterValidations: &apigateway.QueryParameterValidationRequestPolicy{Parameters: []apigateway.QueryParameterValidationItem{apigateway.QueryParameterValidationItem{Name: common.String("EXAMPLE-name-Value"),
						Required: common.Bool(true)}},
						ValidationMode: apigateway.QueryParameterValidationRequestPolicyValidationModeDisabled},
					ResponseCacheLookup: apigateway.SimpleLookupPolicy{CacheKeyAdditions: []string{"EXAMPLE--Value"},
						IsEnabled:               common.Bool(true),
						IsPrivateCachingEnabled: common.Bool(false)},
					Authorization: apigateway.AuthenticationOnlyRouteAuthorizationPolicy{}},
				ResponsePolicies: &apigateway.ApiSpecificationRouteResponsePolicies{HeaderTransformations: &apigateway.HeaderTransformationPolicy{FilterHeaders: &apigateway.FilterHeaderPolicy{Items: []apigateway.FilterHeaderPolicyItem{apigateway.FilterHeaderPolicyItem{Name: common.String("EXAMPLE-name-Value")}},
					Type: apigateway.FilterHeaderPolicyTypeAllow},
					RenameHeaders: &apigateway.RenameHeaderPolicy{Items: []apigateway.RenameHeaderPolicyItem{apigateway.RenameHeaderPolicyItem{From: common.String("EXAMPLE-from-Value"),
						To: common.String("EXAMPLE-to-Value")}}},
					SetHeaders: &apigateway.SetHeaderPolicy{Items: []apigateway.SetHeaderPolicyItem{apigateway.SetHeaderPolicyItem{IfExists: apigateway.SetHeaderPolicyItemIfExistsAppend,
						Name:   common.String("EXAMPLE-name-Value"),
						Values: []string{"EXAMPLE--Value"}}}}},
					ResponseCacheStore: apigateway.FixedTtlResponseCacheStorePolicy{TimeToLiveInSeconds: common.Int(558)}}}},
			LoggingPolicies: &apigateway.ApiSpecificationLoggingPolicies{AccessLog: &apigateway.AccessLogPolicy{IsEnabled: common.Bool(false)},
				ExecutionLog: &apigateway.ExecutionLogPolicy{IsEnabled: common.Bool(true),
					LogLevel: apigateway.ExecutionLogPolicyLogLevelError}}},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		DefinedTags:   map[string]map[string]interface{}{"EXAMPLE_KEY_LPmwy": map[string]interface{}{"EXAMPLE_KEY_u7pQF": "EXAMPLE--Value"}},
		DisplayName:   common.String("EXAMPLE-displayName-Value"),
		FreeformTags:  map[string]string{"EXAMPLE_KEY_uc9Xd": "EXAMPLE_VALUE_aa7usB1teuRCVVf7agBI"},
		GatewayId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-gatewayId-Value"),
		Locks: []apigateway.AddResourceLockDetails{apigateway.AddResourceLockDetails{Message: common.String("EXAMPLE-message-Value"),
			Type: apigateway.AddResourceLockDetailsTypeDelete}}},
		OpcRequestId:  common.String("T8AYUCY9SBJ5ZS68RBO5<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

	// Send the request using the service client
	resp, err := client.CreateDeployment(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}