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

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.ApigatewayService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Apigateway
{
    public class CreateDeploymentExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createDeploymentDetails = new Oci.ApigatewayService.Models.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 = new Oci.ApigatewayService.Models.ApiSpecification
				{
					RequestPolicies = new Oci.ApigatewayService.Models.ApiSpecificationRequestPolicies
					{
						Authentication = new Oci.ApigatewayService.Models.TokenAuthenticationPolicy
						{
							TokenHeader = "EXAMPLE-tokenHeader-Value",
							TokenQueryParam = "EXAMPLE-tokenQueryParam-Value",
							TokenAuthScheme = "EXAMPLE-tokenAuthScheme-Value",
							MaxClockSkewInSeconds = (float)48.890205,
							ValidationPolicy = new Oci.ApigatewayService.Models.TokenAuthenticationRemoteJWKSValidationPolicy
							{
								Uri = "EXAMPLE-uri-Value",
								IsSslVerifyDisabled = true,
								MaxCacheDurationInHours = 20,
								AdditionalValidationPolicy = new Oci.ApigatewayService.Models.AdditionalValidationPolicy
								{
									Issuers = new List<string>
									{
										"EXAMPLE--Value"
									},
									Audiences = new List<string>
									{
										"EXAMPLE--Value"
									},
									VerifyClaims = new List<Oci.ApigatewayService.Models.JsonWebTokenClaim>
									{
										new Oci.ApigatewayService.Models.JsonWebTokenClaim
										{
											Key = "EXAMPLE-key-Value",
											Values = new List<string>
											{
												"EXAMPLE--Value"
											},
											IsRequired = false
										}
									}
								}
							},
							ValidationFailurePolicy = new Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy
							{
								ClientDetails = new Oci.ApigatewayService.Models.CustomClientAppDetails
								{
									ClientId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value",
									ClientSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value",
									ClientSecretVersionNumber = 543
								},
								SourceUriDetails = new Oci.ApigatewayService.Models.DiscoveryUriSourceUriDetails
								{
									Uri = "EXAMPLE-uri-Value"
								},
								Scopes = new List<string>
								{
									"EXAMPLE--Value"
								},
								MaxExpiryDurationInHours = 15,
								UseCookiesForSession = false,
								UseCookiesForIntermediateSteps = true,
								UsePkce = true,
								ResponseType = Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy.ResponseTypeEnum.Code,
								FallbackRedirectPath = "EXAMPLE-fallbackRedirectPath-Value",
								LogoutPath = "EXAMPLE-logoutPath-Value",
								LoginPath = "EXAMPLE-loginPath-Value"
							},
							IsAnonymousAccessAllowed = true
						},
						RateLimiting = new Oci.ApigatewayService.Models.RateLimitingPolicy
						{
							RateInRequestsPerSecond = 8,
							RateKey = Oci.ApigatewayService.Models.RateLimitingPolicy.RateKeyEnum.ClientIp
						},
						Cors = new Oci.ApigatewayService.Models.CorsPolicy
						{
							AllowedOrigins = new List<string>
							{
								"EXAMPLE--Value"
							},
							AllowedMethods = new List<string>
							{
								"EXAMPLE--Value"
							},
							AllowedHeaders = new List<string>
							{
								"EXAMPLE--Value"
							},
							ExposedHeaders = new List<string>
							{
								"EXAMPLE--Value"
							},
							IsAllowCredentialsEnabled = false,
							MaxAgeInSeconds = 417
						},
						MutualTls = new Oci.ApigatewayService.Models.MutualTlsDetails
						{
							IsVerifiedCertificateRequired = true,
							AllowedSans = new List<string>
							{
								"EXAMPLE--Value"
							}
						},
						UsagePlans = new Oci.ApigatewayService.Models.UsagePlansPolicy
						{
							TokenLocations = new List<string>
							{
								"EXAMPLE--Value"
							}
						},
						DynamicAuthentication = new Oci.ApigatewayService.Models.DynamicAuthenticationPolicy
						{
							SelectionSource = new Oci.ApigatewayService.Models.SingleSelectionSourcePolicy
							{
								Selector = "EXAMPLE-selector-Value"
							},
							AuthenticationServers = new List<Oci.ApigatewayService.Models.AuthenticationServerPolicy>
							{
								new Oci.ApigatewayService.Models.AuthenticationServerPolicy
								{
									Key = new Oci.ApigatewayService.Models.WildcardSelectionKey
									{
										Expression = "EXAMPLE-expression-Value",
										IsDefault = false,
										Name = "EXAMPLE-name-Value"
									},
									AuthenticationServerDetail = new Oci.ApigatewayService.Models.CustomAuthenticationPolicy
									{
										FunctionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-functionId-Value",
										TokenHeader = "EXAMPLE-tokenHeader-Value",
										TokenQueryParam = "EXAMPLE-tokenQueryParam-Value",
										Parameters = new Dictionary<string, string>()
										{
											{
												"EXAMPLE_KEY_t55IG", 
												"EXAMPLE_VALUE_XtojypOAPNkgwLVuOJyE"
											}
										},
										CacheKey = new List<string>
										{
											"EXAMPLE--Value"
										},
										ValidationFailurePolicy = new Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy
										{
											ClientDetails = new Oci.ApigatewayService.Models.CustomClientAppDetails
											{
												ClientId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value",
												ClientSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientSecretId-Value",
												ClientSecretVersionNumber = 323
											},
											SourceUriDetails = new Oci.ApigatewayService.Models.DiscoveryUriSourceUriDetails
											{
												Uri = "EXAMPLE-uri-Value"
											},
											Scopes = new List<string>
											{
												"EXAMPLE--Value"
											},
											MaxExpiryDurationInHours = 3,
											UseCookiesForSession = true,
											UseCookiesForIntermediateSteps = true,
											UsePkce = false,
											ResponseType = Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy.ResponseTypeEnum.Code,
											FallbackRedirectPath = "EXAMPLE-fallbackRedirectPath-Value",
											LogoutPath = "EXAMPLE-logoutPath-Value",
											LoginPath = "EXAMPLE-loginPath-Value"
										},
										IsAnonymousAccessAllowed = true
									}
								}
							}
						}
					},
					LoggingPolicies = new Oci.ApigatewayService.Models.ApiSpecificationLoggingPolicies
					{
						AccessLog = new Oci.ApigatewayService.Models.AccessLogPolicy
						{
							IsEnabled = true
						},
						ExecutionLog = new Oci.ApigatewayService.Models.ExecutionLogPolicy
						{
							IsEnabled = false,
							LogLevel = Oci.ApigatewayService.Models.ExecutionLogPolicy.LogLevelEnum.Info
						}
					},
					Routes = new List<Oci.ApigatewayService.Models.ApiSpecificationRoute>
					{
						new Oci.ApigatewayService.Models.ApiSpecificationRoute
						{
							Path = "EXAMPLE-path-Value",
							Methods = new List<Oci.ApigatewayService.Models.ApiSpecificationRoute.MethodsEnum>
							{
								Oci.ApigatewayService.Models.ApiSpecificationRoute.MethodsEnum.Delete
							},
							RequestPolicies = new Oci.ApigatewayService.Models.ApiSpecificationRouteRequestPolicies
							{
								Authorization = new Oci.ApigatewayService.Models.AnyOfRouteAuthorizationPolicy
								{
									AllowedScope = new List<string>
									{
										"EXAMPLE--Value"
									}
								},
								Cors = new Oci.ApigatewayService.Models.CorsPolicy
								{
									AllowedOrigins = new List<string>
									{
										"EXAMPLE--Value"
									},
									AllowedMethods = new List<string>
									{
										"EXAMPLE--Value"
									},
									AllowedHeaders = new List<string>
									{
										"EXAMPLE--Value"
									},
									ExposedHeaders = new List<string>
									{
										"EXAMPLE--Value"
									},
									IsAllowCredentialsEnabled = false,
									MaxAgeInSeconds = 146
								},
								QueryParameterValidations = new Oci.ApigatewayService.Models.QueryParameterValidationRequestPolicy
								{
									Parameters = new List<Oci.ApigatewayService.Models.QueryParameterValidationItem>
									{
										new Oci.ApigatewayService.Models.QueryParameterValidationItem
										{
											Required = true,
											Name = "EXAMPLE-name-Value"
										}
									},
									ValidationMode = Oci.ApigatewayService.Models.QueryParameterValidationRequestPolicy.ValidationModeEnum.Enforcing
								},
								HeaderValidations = new Oci.ApigatewayService.Models.HeaderValidationRequestPolicy
								{
									Headers = new List<Oci.ApigatewayService.Models.HeaderValidationItem>
									{
										new Oci.ApigatewayService.Models.HeaderValidationItem
										{
											Required = true,
											Name = "EXAMPLE-name-Value"
										}
									},
									ValidationMode = Oci.ApigatewayService.Models.HeaderValidationRequestPolicy.ValidationModeEnum.Enforcing
								},
								BodyValidation = new Oci.ApigatewayService.Models.BodyValidationRequestPolicy
								{
									Required = false,
									Content = new Dictionary<string, Oci.ApigatewayService.Models.ContentValidation>()
									{
										{
											"EXAMPLE_KEY_RpaoV", 
											new Oci.ApigatewayService.Models.NoContentValidation
											{
											}
										}
									},
									ValidationMode = Oci.ApigatewayService.Models.BodyValidationRequestPolicy.ValidationModeEnum.Disabled
								},
								HeaderTransformations = new Oci.ApigatewayService.Models.HeaderTransformationPolicy
								{
									SetHeaders = new Oci.ApigatewayService.Models.SetHeaderPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.SetHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.SetHeaderPolicyItem
											{
												Name = "EXAMPLE-name-Value",
												Values = new List<string>
												{
													"EXAMPLE--Value"
												},
												IfExists = Oci.ApigatewayService.Models.SetHeaderPolicyItem.IfExistsEnum.Overwrite
											}
										}
									},
									RenameHeaders = new Oci.ApigatewayService.Models.RenameHeaderPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.RenameHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.RenameHeaderPolicyItem
											{
												From = "EXAMPLE-from-Value",
												To = "EXAMPLE-to-Value"
											}
										}
									},
									FilterHeaders = new Oci.ApigatewayService.Models.FilterHeaderPolicy
									{
										Type = Oci.ApigatewayService.Models.FilterHeaderPolicy.TypeEnum.Allow,
										Items = new List<Oci.ApigatewayService.Models.FilterHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.FilterHeaderPolicyItem
											{
												Name = "EXAMPLE-name-Value"
											}
										}
									}
								},
								QueryParameterTransformations = new Oci.ApigatewayService.Models.QueryParameterTransformationPolicy
								{
									SetQueryParameters = new Oci.ApigatewayService.Models.SetQueryParameterPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.SetQueryParameterPolicyItem>
										{
											new Oci.ApigatewayService.Models.SetQueryParameterPolicyItem
											{
												Name = "EXAMPLE-name-Value",
												Values = new List<string>
												{
													"EXAMPLE--Value"
												},
												IfExists = Oci.ApigatewayService.Models.SetQueryParameterPolicyItem.IfExistsEnum.Overwrite
											}
										}
									},
									RenameQueryParameters = new Oci.ApigatewayService.Models.RenameQueryParameterPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.RenameQueryParameterPolicyItem>
										{
											new Oci.ApigatewayService.Models.RenameQueryParameterPolicyItem
											{
												From = "EXAMPLE-from-Value",
												To = "EXAMPLE-to-Value"
											}
										}
									},
									FilterQueryParameters = new Oci.ApigatewayService.Models.FilterQueryParameterPolicy
									{
										Type = Oci.ApigatewayService.Models.FilterQueryParameterPolicy.TypeEnum.Allow,
										Items = new List<Oci.ApigatewayService.Models.FilterQueryParameterPolicyItem>
										{
											new Oci.ApigatewayService.Models.FilterQueryParameterPolicyItem
											{
												Name = "EXAMPLE-name-Value"
											}
										}
									}
								},
								ResponseCacheLookup = new Oci.ApigatewayService.Models.SimpleLookupPolicy
								{
									CacheKeyAdditions = new List<string>
									{
										"EXAMPLE--Value"
									},
									IsEnabled = false,
									IsPrivateCachingEnabled = false
								}
							},
							ResponsePolicies = new Oci.ApigatewayService.Models.ApiSpecificationRouteResponsePolicies
							{
								HeaderTransformations = new Oci.ApigatewayService.Models.HeaderTransformationPolicy
								{
									SetHeaders = new Oci.ApigatewayService.Models.SetHeaderPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.SetHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.SetHeaderPolicyItem
											{
												Name = "EXAMPLE-name-Value",
												Values = new List<string>
												{
													"EXAMPLE--Value"
												},
												IfExists = Oci.ApigatewayService.Models.SetHeaderPolicyItem.IfExistsEnum.Append
											}
										}
									},
									RenameHeaders = new Oci.ApigatewayService.Models.RenameHeaderPolicy
									{
										Items = new List<Oci.ApigatewayService.Models.RenameHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.RenameHeaderPolicyItem
											{
												From = "EXAMPLE-from-Value",
												To = "EXAMPLE-to-Value"
											}
										}
									},
									FilterHeaders = new Oci.ApigatewayService.Models.FilterHeaderPolicy
									{
										Type = Oci.ApigatewayService.Models.FilterHeaderPolicy.TypeEnum.Block,
										Items = new List<Oci.ApigatewayService.Models.FilterHeaderPolicyItem>
										{
											new Oci.ApigatewayService.Models.FilterHeaderPolicyItem
											{
												Name = "EXAMPLE-name-Value"
											}
										}
									}
								},
								ResponseCacheStore = new Oci.ApigatewayService.Models.FixedTTLResponseCacheStorePolicy
								{
									TimeToLiveInSeconds = 576
								}
							},
							LoggingPolicies = new Oci.ApigatewayService.Models.ApiSpecificationLoggingPolicies
							{
								AccessLog = new Oci.ApigatewayService.Models.AccessLogPolicy
								{
									IsEnabled = true
								},
								ExecutionLog = new Oci.ApigatewayService.Models.ExecutionLogPolicy
								{
									IsEnabled = true,
									LogLevel = Oci.ApigatewayService.Models.ExecutionLogPolicy.LogLevelEnum.Error
								}
							},
							Backend = new Oci.ApigatewayService.Models.OAuth2LogoutBackend
							{
								AllowedPostLogoutUris = new List<string>
								{
									"EXAMPLE--Value"
								},
								PostLogoutState = "EXAMPLE-postLogoutState-Value"
							}
						}
					}
				},
				Locks = new List<Oci.ApigatewayService.Models.AddResourceLockDetails>
				{
					new Oci.ApigatewayService.Models.AddResourceLockDetails
					{
						Type = Oci.ApigatewayService.Models.AddResourceLockDetails.TypeEnum.Full,
						Message = "EXAMPLE-message-Value"
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_g1KZv", 
						"EXAMPLE_VALUE_2hYFegvMqOW1jGi9pLcS"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_8PcKD", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_zjNwa", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createDeploymentRequest = new Oci.ApigatewayService.Requests.CreateDeploymentRequest
			{
				CreateDeploymentDetails = createDeploymentDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "GQUJGG2A52IDQFOYUSJH<unique_ID>"
			};

            // 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. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new DeploymentClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateDeployment(createDeploymentRequest);
					// Retrieve value from the response.
					var id = response.Deployment.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateDeployment Failed with {e.Message}");
                throw e;
            }
        }

    }
}