// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package appsync import ( "context" "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" ) // Represents the input of a UpdateApiCache operation. type UpdateApiCacheInput struct { _ struct{} `type:"structure"` // Caching behavior. // // * FULL_REQUEST_CACHING: All requests are fully cached. // // * PER_RESOLVER_CACHING: Individual resovlers that you specify are cached. // // ApiCachingBehavior is a required field ApiCachingBehavior ApiCachingBehavior `locationName:"apiCachingBehavior" type:"string" required:"true" enum:"true"` // The GraphQL API Id. // // ApiId is a required field ApiId *string `location:"uri" locationName:"apiId" type:"string" required:"true"` // TTL in seconds for cache entries. // // Valid values are between 1 and 3600 seconds. // // Ttl is a required field Ttl *int64 `locationName:"ttl" type:"long" required:"true"` // The cache instance type. // // * T2_SMALL: A t2.small instance type. // // * T2_MEDIUM: A t2.medium instance type. // // * R4_LARGE: A r4.large instance type. // // * R4_XLARGE: A r4.xlarge instance type. // // * R4_2XLARGE: A r4.2xlarge instance type. // // * R4_4XLARGE: A r4.4xlarge instance type. // // * R4_8XLARGE: A r4.8xlarge instance type. // // Type is a required field Type ApiCacheType `locationName:"type" type:"string" required:"true" enum:"true"` } // String returns the string representation func (s UpdateApiCacheInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *UpdateApiCacheInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "UpdateApiCacheInput"} if len(s.ApiCachingBehavior) == 0 { invalidParams.Add(aws.NewErrParamRequired("ApiCachingBehavior")) } if s.ApiId == nil { invalidParams.Add(aws.NewErrParamRequired("ApiId")) } if s.Ttl == nil { invalidParams.Add(aws.NewErrParamRequired("Ttl")) } if len(s.Type) == 0 { invalidParams.Add(aws.NewErrParamRequired("Type")) } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateApiCacheInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if len(s.ApiCachingBehavior) > 0 { v := s.ApiCachingBehavior metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "apiCachingBehavior", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.Ttl != nil { v := *s.Ttl metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "ttl", protocol.Int64Value(v), metadata) } if len(s.Type) > 0 { v := s.Type metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "type", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.ApiId != nil { v := *s.ApiId metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "apiId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } // Represents the output of a UpdateApiCache operation. type UpdateApiCacheOutput struct { _ struct{} `type:"structure"` // The ApiCache object. ApiCache *ApiCache `locationName:"apiCache" type:"structure"` } // String returns the string representation func (s UpdateApiCacheOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateApiCacheOutput) MarshalFields(e protocol.FieldEncoder) error { if s.ApiCache != nil { v := s.ApiCache metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "apiCache", v, metadata) } return nil } const opUpdateApiCache = "UpdateApiCache" // UpdateApiCacheRequest returns a request value for making API operation for // AWS AppSync. // // Updates the cache for the GraphQL API. // // // Example sending a request using UpdateApiCacheRequest. // req := client.UpdateApiCacheRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/appsync-2017-07-25/UpdateApiCache func (c *Client) UpdateApiCacheRequest(input *UpdateApiCacheInput) UpdateApiCacheRequest { op := &aws.Operation{ Name: opUpdateApiCache, HTTPMethod: "POST", HTTPPath: "/v1/apis/{apiId}/ApiCaches/update", } if input == nil { input = &UpdateApiCacheInput{} } req := c.newRequest(op, input, &UpdateApiCacheOutput{}) return UpdateApiCacheRequest{Request: req, Input: input, Copy: c.UpdateApiCacheRequest} } // UpdateApiCacheRequest is the request type for the // UpdateApiCache API operation. type UpdateApiCacheRequest struct { *aws.Request Input *UpdateApiCacheInput Copy func(*UpdateApiCacheInput) UpdateApiCacheRequest } // Send marshals and sends the UpdateApiCache API request. func (r UpdateApiCacheRequest) Send(ctx context.Context) (*UpdateApiCacheResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &UpdateApiCacheResponse{ UpdateApiCacheOutput: r.Request.Data.(*UpdateApiCacheOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // UpdateApiCacheResponse is the response type for the // UpdateApiCache API operation. type UpdateApiCacheResponse struct { *UpdateApiCacheOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // UpdateApiCache request. func (r *UpdateApiCacheResponse) SDKResponseMetdata() *aws.Response { return r.response }