// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package apigateway import ( "context" "time" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awsutil" "github.com/aws/aws-sdk-go-v2/private/protocol" ) // A request to change information about an ApiKey resource. type UpdateApiKeyInput struct { _ struct{} `type:"structure"` // [Required] The identifier of the ApiKey resource to be updated. // // ApiKey is a required field ApiKey *string `location:"uri" locationName:"api_Key" type:"string" required:"true"` // A list of update operations to be applied to the specified resource and in // the order specified in this list. PatchOperations []PatchOperation `locationName:"patchOperations" type:"list"` } // String returns the string representation func (s UpdateApiKeyInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *UpdateApiKeyInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "UpdateApiKeyInput"} if s.ApiKey == nil { invalidParams.Add(aws.NewErrParamRequired("ApiKey")) } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateApiKeyInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if s.PatchOperations != nil { v := s.PatchOperations metadata := protocol.Metadata{} ls0 := e.List(protocol.BodyTarget, "patchOperations", metadata) ls0.Start() for _, v1 := range v { ls0.ListAddFields(v1) } ls0.End() } if s.ApiKey != nil { v := *s.ApiKey metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "api_Key", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } // A resource that can be distributed to callers for executing Method resources // that require an API key. API keys can be mapped to any Stage on any RestApi, // which indicates that the callers with the API key can make requests to that // stage. // // Use API Keys (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-api-keys.html) type UpdateApiKeyOutput struct { _ struct{} `type:"structure"` // The timestamp when the API Key was created. CreatedDate *time.Time `locationName:"createdDate" type:"timestamp"` // An AWS Marketplace customer identifier , when integrating with the AWS SaaS // Marketplace. CustomerId *string `locationName:"customerId" type:"string"` // The description of the API Key. Description *string `locationName:"description" type:"string"` // Specifies whether the API Key can be used by callers. Enabled *bool `locationName:"enabled" type:"boolean"` // The identifier of the API Key. Id *string `locationName:"id" type:"string"` // The timestamp when the API Key was last updated. LastUpdatedDate *time.Time `locationName:"lastUpdatedDate" type:"timestamp"` // The name of the API Key. Name *string `locationName:"name" type:"string"` // A list of Stage resources that are associated with the ApiKey resource. StageKeys []string `locationName:"stageKeys" type:"list"` // The collection of tags. Each tag element is associated with a given resource. Tags map[string]string `locationName:"tags" type:"map"` // The value of the API Key. Value *string `locationName:"value" type:"string"` } // String returns the string representation func (s UpdateApiKeyOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateApiKeyOutput) MarshalFields(e protocol.FieldEncoder) error { if s.CreatedDate != nil { v := *s.CreatedDate metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "createdDate", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata) } if s.CustomerId != nil { v := *s.CustomerId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "customerId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Description != nil { v := *s.Description metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Enabled != nil { v := *s.Enabled metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "enabled", protocol.BoolValue(v), metadata) } if s.Id != nil { v := *s.Id metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "id", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.LastUpdatedDate != nil { v := *s.LastUpdatedDate metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "lastUpdatedDate", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata) } if s.Name != nil { v := *s.Name metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.StageKeys != nil { v := s.StageKeys metadata := protocol.Metadata{} ls0 := e.List(protocol.BodyTarget, "stageKeys", metadata) ls0.Start() for _, v1 := range v { ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) } ls0.End() } if s.Tags != nil { v := s.Tags metadata := protocol.Metadata{} ms0 := e.Map(protocol.BodyTarget, "tags", metadata) ms0.Start() for k1, v1 := range v { ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) } ms0.End() } if s.Value != nil { v := *s.Value metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "value", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } const opUpdateApiKey = "UpdateApiKey" // UpdateApiKeyRequest returns a request value for making API operation for // Amazon API Gateway. // // Changes information about an ApiKey resource. // // // Example sending a request using UpdateApiKeyRequest. // req := client.UpdateApiKeyRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } func (c *Client) UpdateApiKeyRequest(input *UpdateApiKeyInput) UpdateApiKeyRequest { op := &aws.Operation{ Name: opUpdateApiKey, HTTPMethod: "PATCH", HTTPPath: "/apikeys/{api_Key}", } if input == nil { input = &UpdateApiKeyInput{} } req := c.newRequest(op, input, &UpdateApiKeyOutput{}) return UpdateApiKeyRequest{Request: req, Input: input, Copy: c.UpdateApiKeyRequest} } // UpdateApiKeyRequest is the request type for the // UpdateApiKey API operation. type UpdateApiKeyRequest struct { *aws.Request Input *UpdateApiKeyInput Copy func(*UpdateApiKeyInput) UpdateApiKeyRequest } // Send marshals and sends the UpdateApiKey API request. func (r UpdateApiKeyRequest) Send(ctx context.Context) (*UpdateApiKeyResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &UpdateApiKeyResponse{ UpdateApiKeyOutput: r.Request.Data.(*UpdateApiKeyOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // UpdateApiKeyResponse is the response type for the // UpdateApiKey API operation. type UpdateApiKeyResponse struct { *UpdateApiKeyOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // UpdateApiKey request. func (r *UpdateApiKeyResponse) SDKResponseMetdata() *aws.Response { return r.response }