// 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 UpdateDeploymentExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateDeploymentDetails = new Oci.ApigatewayService.Models.UpdateDeploymentDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Specification = new Oci.ApigatewayService.Models.ApiSpecification
				{
					RequestPolicies = new Oci.ApigatewayService.Models.ApiSpecificationRequestPolicies
					{
						Authentication = 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_hzdwr", 
									"EXAMPLE_VALUE_bCPtZFeJ4gQ37QFJ7Dow"
								}
							},
							CacheKey = new List<string>
							{
								"EXAMPLE--Value"
							},
							ValidationFailurePolicy = new Oci.ApigatewayService.Models.ModifyResponseValidationFailurePolicy
							{
								ResponseCode = "EXAMPLE-responseCode-Value",
								ResponseMessage = "EXAMPLE-responseMessage-Value",
								ResponseHeaderTransformations = 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"
											}
										}
									}
								}
							},
							IsAnonymousAccessAllowed = false
						},
						RateLimiting = new Oci.ApigatewayService.Models.RateLimitingPolicy
						{
							RateInRequestsPerSecond = 999,
							RateKey = Oci.ApigatewayService.Models.RateLimitingPolicy.RateKeyEnum.Total
						},
						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 = true,
							MaxAgeInSeconds = 6
						},
						MutualTls = new Oci.ApigatewayService.Models.MutualTlsDetails
						{
							IsVerifiedCertificateRequired = false,
							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 = true,
										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_lpU4P", 
												"EXAMPLE_VALUE_0cre59DRx9K4B1xiRT6N"
											}
										},
										CacheKey = new List<string>
										{
											"EXAMPLE--Value"
										},
										ValidationFailurePolicy = new Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy
										{
											ClientDetails = new Oci.ApigatewayService.Models.ValidationBlockClientAppDetails
											{
											},
											SourceUriDetails = new Oci.ApigatewayService.Models.DiscoveryUriSourceUriDetails
											{
												Uri = "EXAMPLE-uri-Value"
											},
											Scopes = new List<string>
											{
												"EXAMPLE--Value"
											},
											MaxExpiryDurationInHours = 2,
											UseCookiesForSession = true,
											UseCookiesForIntermediateSteps = false,
											UsePkce = true,
											ResponseType = Oci.ApigatewayService.Models.OAuth2ResponseValidationFailurePolicy.ResponseTypeEnum.Code,
											FallbackRedirectPath = "EXAMPLE-fallbackRedirectPath-Value",
											LogoutPath = "EXAMPLE-logoutPath-Value"
										},
										IsAnonymousAccessAllowed = false
									}
								}
							}
						}
					},
					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.Error
						}
					},
					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.Head
							},
							RequestPolicies = new Oci.ApigatewayService.Models.ApiSpecificationRouteRequestPolicies
							{
								Authorization = new Oci.ApigatewayService.Models.AuthenticationOnlyRouteAuthorizationPolicy
								{
								},
								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 = 613
								},
								QueryParameterValidations = new Oci.ApigatewayService.Models.QueryParameterValidationRequestPolicy
								{
									Parameters = new List<Oci.ApigatewayService.Models.QueryParameterValidationItem>
									{
										new Oci.ApigatewayService.Models.QueryParameterValidationItem
										{
											Required = false,
											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.Disabled
								},
								BodyValidation = new Oci.ApigatewayService.Models.BodyValidationRequestPolicy
								{
									Required = false,
									Content = new Dictionary<string, Oci.ApigatewayService.Models.ContentValidation>()
									{
										{
											"EXAMPLE_KEY_yr42m", 
											new Oci.ApigatewayService.Models.NoContentValidation
											{
											}
										}
									},
									ValidationMode = Oci.ApigatewayService.Models.BodyValidationRequestPolicy.ValidationModeEnum.Enforcing
								},
								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.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.Skip
											}
										}
									},
									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 = true
								}
							},
							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.Skip
											}
										}
									},
									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"
											}
										}
									}
								},
								ResponseCacheStore = new Oci.ApigatewayService.Models.FixedTTLResponseCacheStorePolicy
								{
									TimeToLiveInSeconds = 386
								}
							},
							LoggingPolicies = new Oci.ApigatewayService.Models.ApiSpecificationLoggingPolicies
							{
								AccessLog = new Oci.ApigatewayService.Models.AccessLogPolicy
								{
									IsEnabled = false
								},
								ExecutionLog = new Oci.ApigatewayService.Models.ExecutionLogPolicy
								{
									IsEnabled = false,
									LogLevel = Oci.ApigatewayService.Models.ExecutionLogPolicy.LogLevelEnum.Error
								}
							},
							Backend = new Oci.ApigatewayService.Models.DynamicRoutingBackend
							{
								SelectionSource = new Oci.ApigatewayService.Models.SingleSelectionSourcePolicy
								{
									Selector = "EXAMPLE-selector-Value"
								},
								RoutingBackends = new List<Oci.ApigatewayService.Models.DynamicRoutingTypeRoutingBackend>
								{
									new Oci.ApigatewayService.Models.DynamicRoutingTypeRoutingBackend
									{
										Key = new Oci.ApigatewayService.Models.AnyOfSelectionKey
										{
											Values = new List<string>
											{
												"EXAMPLE--Value"
											},
											IsDefault = false,
											Name = "EXAMPLE-name-Value"
										},
									}
								}
							}
						}
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_QV3rM", 
						"EXAMPLE_VALUE_Cfe6k5JS1hxND6N2b9hy"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_bjZlb", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_sUttD", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var updateDeploymentRequest = new Oci.ApigatewayService.Requests.UpdateDeploymentRequest
			{
				DeploymentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentId-Value",
				UpdateDeploymentDetails = updateDeploymentDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "QSQUESWV4820CMSLXTJM<unique_ID>",
				IsLockOverride = true
			};

            // 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.UpdateDeployment(updateDeploymentRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateDeployment Failed with {e.Message}");
                throw e;
            }
        }

    }
}