1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package apigateway 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/apigateway/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "time" 13) 14 15// A feature of the API Gateway control service for updating an existing API with 16// an input of external API definitions. The update can take the form of merging 17// the supplied definition into the existing API or overwriting the existing API. 18func (c *Client) PutRestApi(ctx context.Context, params *PutRestApiInput, optFns ...func(*Options)) (*PutRestApiOutput, error) { 19 if params == nil { 20 params = &PutRestApiInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "PutRestApi", params, optFns, addOperationPutRestApiMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*PutRestApiOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33// A PUT request to update an existing API, with external API definitions specified 34// as the request body. 35type PutRestApiInput struct { 36 37 // [Required] The string identifier of the associated RestApi. 38 // 39 // This member is required. 40 RestApiId *string 41 42 // A query parameter to indicate whether to rollback the API update (true) or not 43 // (false) when a warning is encountered. The default value is false. 44 FailOnWarnings bool 45 46 // The mode query parameter to specify the update mode. Valid values are "merge" 47 // and "overwrite". By default, the update mode is "merge". 48 Mode types.PutMode 49 50 // Custom header parameters as part of the request. For example, to exclude 51 // DocumentationParts from an imported API, set ignore=documentation as a 52 // parameters value, as in the AWS CLI command of aws apigateway import-rest-api 53 // --parameters ignore=documentation --body 54 // 'file:///path/to/imported-api-body.json'. 55 Parameters map[string]string 56} 57 58// Represents a REST API. Create an API 59// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html) 60type PutRestApiOutput struct { 61 62 // The source of the API key for metering requests according to a usage plan. Valid 63 // values are: 64 // 65 // * HEADER to read the API key from the X-API-Key header of a 66 // request. 67 // 68 // * AUTHORIZER to read the API key from the UsageIdentifierKey from a 69 // custom authorizer. 70 ApiKeySource types.ApiKeySourceType 71 72 // The list of binary media types supported by the RestApi. By default, the RestApi 73 // supports only UTF-8-encoded text payloads. 74 BinaryMediaTypes []string 75 76 // The timestamp when the API was created. 77 CreatedDate *time.Time 78 79 // The API's description. 80 Description *string 81 82 // Specifies whether clients can invoke your API by using the default execute-api 83 // endpoint. By default, clients can invoke your API with the default 84 // https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that 85 // clients use a custom domain name to invoke your API, disable the default 86 // endpoint. 87 DisableExecuteApiEndpoint bool 88 89 // The endpoint configuration of this RestApi showing the endpoint types of the 90 // API. 91 EndpointConfiguration *types.EndpointConfiguration 92 93 // The API's identifier. This identifier is unique across all of your APIs in API 94 // Gateway. 95 Id *string 96 97 // A nullable integer that is used to enable compression (with non-negative between 98 // 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null 99 // value) on an API. When compression is enabled, compression or decompression is 100 // not applied on the payload if the payload size is smaller than this value. 101 // Setting it to zero allows compression for any payload size. 102 MinimumCompressionSize *int32 103 104 // The API's name. 105 Name *string 106 107 // A stringified JSON policy document that applies to this RestApi regardless of 108 // the caller and Method configuration. 109 Policy *string 110 111 // The collection of tags. Each tag element is associated with a given resource. 112 Tags map[string]string 113 114 // A version identifier for the API. 115 Version *string 116 117 // The warning messages reported when failonwarnings is turned on during API 118 // import. 119 Warnings []string 120 121 // Metadata pertaining to the operation's result. 122 ResultMetadata middleware.Metadata 123} 124 125func addOperationPutRestApiMiddlewares(stack *middleware.Stack, options Options) (err error) { 126 err = stack.Serialize.Add(&awsRestjson1_serializeOpPutRestApi{}, middleware.After) 127 if err != nil { 128 return err 129 } 130 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPutRestApi{}, middleware.After) 131 if err != nil { 132 return err 133 } 134 if err = addSetLoggerMiddleware(stack, options); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 138 return err 139 } 140 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addResolveEndpointMiddleware(stack, options); err != nil { 144 return err 145 } 146 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 147 return err 148 } 149 if err = addRetryMiddlewares(stack, options); err != nil { 150 return err 151 } 152 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 153 return err 154 } 155 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 156 return err 157 } 158 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 159 return err 160 } 161 if err = addClientUserAgent(stack); err != nil { 162 return err 163 } 164 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 165 return err 166 } 167 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 168 return err 169 } 170 if err = addOpPutRestApiValidationMiddleware(stack); err != nil { 171 return err 172 } 173 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRestApi(options.Region), middleware.Before); err != nil { 174 return err 175 } 176 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 177 return err 178 } 179 if err = addResponseErrorMiddleware(stack); err != nil { 180 return err 181 } 182 if err = addAcceptHeader(stack); err != nil { 183 return err 184 } 185 if err = addRequestResponseLogging(stack, options); err != nil { 186 return err 187 } 188 return nil 189} 190 191func newServiceMetadataMiddleware_opPutRestApi(region string) *awsmiddleware.RegisterServiceMetadata { 192 return &awsmiddleware.RegisterServiceMetadata{ 193 Region: region, 194 ServiceID: ServiceID, 195 SigningName: "apigateway", 196 OperationName: "PutRestApi", 197 } 198} 199