// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package appmesh 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" ) type UpdateVirtualNodeInput struct { _ struct{} `type:"structure"` ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` // MeshName is a required field MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` MeshOwner *string `location:"querystring" locationName:"meshOwner" min:"12" type:"string"` // An object that represents the specification of a virtual node. // // Spec is a required field Spec *VirtualNodeSpec `locationName:"spec" type:"structure" required:"true"` // VirtualNodeName is a required field VirtualNodeName *string `location:"uri" locationName:"virtualNodeName" min:"1" type:"string" required:"true"` } // String returns the string representation func (s UpdateVirtualNodeInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *UpdateVirtualNodeInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "UpdateVirtualNodeInput"} if s.MeshName == nil { invalidParams.Add(aws.NewErrParamRequired("MeshName")) } if s.MeshName != nil && len(*s.MeshName) < 1 { invalidParams.Add(aws.NewErrParamMinLen("MeshName", 1)) } if s.MeshOwner != nil && len(*s.MeshOwner) < 12 { invalidParams.Add(aws.NewErrParamMinLen("MeshOwner", 12)) } if s.Spec == nil { invalidParams.Add(aws.NewErrParamRequired("Spec")) } if s.VirtualNodeName == nil { invalidParams.Add(aws.NewErrParamRequired("VirtualNodeName")) } if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { invalidParams.Add(aws.NewErrParamMinLen("VirtualNodeName", 1)) } if s.Spec != nil { if err := s.Spec.Validate(); err != nil { invalidParams.AddNested("Spec", err.(aws.ErrInvalidParams)) } } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateVirtualNodeInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) var ClientToken string if s.ClientToken != nil { ClientToken = *s.ClientToken } else { ClientToken = protocol.GetIdempotencyToken() } { v := ClientToken metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "clientToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.Spec != nil { v := s.Spec metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "spec", v, metadata) } if s.MeshName != nil { v := *s.MeshName metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "meshName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.VirtualNodeName != nil { v := *s.VirtualNodeName metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "virtualNodeName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.MeshOwner != nil { v := *s.MeshOwner metadata := protocol.Metadata{} e.SetValue(protocol.QueryTarget, "meshOwner", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } type UpdateVirtualNodeOutput struct { _ struct{} `type:"structure" payload:"VirtualNode"` // An object that represents a virtual node returned by a describe operation. // // VirtualNode is a required field VirtualNode *VirtualNodeData `locationName:"virtualNode" type:"structure" required:"true"` } // String returns the string representation func (s UpdateVirtualNodeOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s UpdateVirtualNodeOutput) MarshalFields(e protocol.FieldEncoder) error { if s.VirtualNode != nil { v := s.VirtualNode metadata := protocol.Metadata{} e.SetFields(protocol.PayloadTarget, "virtualNode", v, metadata) } return nil } const opUpdateVirtualNode = "UpdateVirtualNode" // UpdateVirtualNodeRequest returns a request value for making API operation for // AWS App Mesh. // // Updates an existing virtual node in a specified service mesh. // // // Example sending a request using UpdateVirtualNodeRequest. // req := client.UpdateVirtualNodeRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/appmesh-2019-01-25/UpdateVirtualNode func (c *Client) UpdateVirtualNodeRequest(input *UpdateVirtualNodeInput) UpdateVirtualNodeRequest { op := &aws.Operation{ Name: opUpdateVirtualNode, HTTPMethod: "PUT", HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}", } if input == nil { input = &UpdateVirtualNodeInput{} } req := c.newRequest(op, input, &UpdateVirtualNodeOutput{}) return UpdateVirtualNodeRequest{Request: req, Input: input, Copy: c.UpdateVirtualNodeRequest} } // UpdateVirtualNodeRequest is the request type for the // UpdateVirtualNode API operation. type UpdateVirtualNodeRequest struct { *aws.Request Input *UpdateVirtualNodeInput Copy func(*UpdateVirtualNodeInput) UpdateVirtualNodeRequest } // Send marshals and sends the UpdateVirtualNode API request. func (r UpdateVirtualNodeRequest) Send(ctx context.Context) (*UpdateVirtualNodeResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &UpdateVirtualNodeResponse{ UpdateVirtualNodeOutput: r.Request.Data.(*UpdateVirtualNodeOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // UpdateVirtualNodeResponse is the response type for the // UpdateVirtualNode API operation. type UpdateVirtualNodeResponse struct { *UpdateVirtualNodeOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // UpdateVirtualNode request. func (r *UpdateVirtualNodeResponse) SDKResponseMetdata() *aws.Response { return r.response }