// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package iotsitewise 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" "github.com/aws/aws-sdk-go-v2/private/protocol/restjson" ) type DisassociateAssetsInput struct { _ struct{} `type:"structure"` // The ID of the parent asset from which to disassociate the child asset. // // AssetId is a required field AssetId *string `location:"uri" locationName:"assetId" min:"36" type:"string" required:"true"` // The ID of the child asset to disassociate. // // ChildAssetId is a required field ChildAssetId *string `locationName:"childAssetId" min:"36" type:"string" required:"true"` // A unique case-sensitive identifier that you can provide to ensure the idempotency // of the request. Don't reuse this client token if a new idempotent request // is required. ClientToken *string `locationName:"clientToken" min:"36" type:"string" idempotencyToken:"true"` // The ID of a hierarchy in the parent asset's model. Hierarchies allow different // groupings of assets to be formed that all come from the same asset model. // You can use the hierarchy ID to identify the correct asset to disassociate. // For more information, see Asset Hierarchies (https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html) // in the AWS IoT SiteWise User Guide. // // HierarchyId is a required field HierarchyId *string `locationName:"hierarchyId" min:"36" type:"string" required:"true"` } // String returns the string representation func (s DisassociateAssetsInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *DisassociateAssetsInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "DisassociateAssetsInput"} if s.AssetId == nil { invalidParams.Add(aws.NewErrParamRequired("AssetId")) } if s.AssetId != nil && len(*s.AssetId) < 36 { invalidParams.Add(aws.NewErrParamMinLen("AssetId", 36)) } if s.ChildAssetId == nil { invalidParams.Add(aws.NewErrParamRequired("ChildAssetId")) } if s.ChildAssetId != nil && len(*s.ChildAssetId) < 36 { invalidParams.Add(aws.NewErrParamMinLen("ChildAssetId", 36)) } if s.ClientToken != nil && len(*s.ClientToken) < 36 { invalidParams.Add(aws.NewErrParamMinLen("ClientToken", 36)) } if s.HierarchyId == nil { invalidParams.Add(aws.NewErrParamRequired("HierarchyId")) } if s.HierarchyId != nil && len(*s.HierarchyId) < 36 { invalidParams.Add(aws.NewErrParamMinLen("HierarchyId", 36)) } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s DisassociateAssetsInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if s.ChildAssetId != nil { v := *s.ChildAssetId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "childAssetId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, 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.HierarchyId != nil { v := *s.HierarchyId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "hierarchyId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.AssetId != nil { v := *s.AssetId metadata := protocol.Metadata{} e.SetValue(protocol.PathTarget, "assetId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } type DisassociateAssetsOutput struct { _ struct{} `type:"structure"` } // String returns the string representation func (s DisassociateAssetsOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s DisassociateAssetsOutput) MarshalFields(e protocol.FieldEncoder) error { return nil } const opDisassociateAssets = "DisassociateAssets" // DisassociateAssetsRequest returns a request value for making API operation for // AWS IoT SiteWise. // // Disassociates a child asset from the given parent asset through a hierarchy // defined in the parent asset's model. // // // Example sending a request using DisassociateAssetsRequest. // req := client.DisassociateAssetsRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/iotsitewise-2019-12-02/DisassociateAssets func (c *Client) DisassociateAssetsRequest(input *DisassociateAssetsInput) DisassociateAssetsRequest { op := &aws.Operation{ Name: opDisassociateAssets, HTTPMethod: "POST", HTTPPath: "/assets/{assetId}/disassociate", } if input == nil { input = &DisassociateAssetsInput{} } req := c.newRequest(op, input, &DisassociateAssetsOutput{}) req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) req.Handlers.Build.PushBackNamed(protocol.NewHostPrefixHandler("model.", nil)) req.Handlers.Build.PushBackNamed(protocol.ValidateEndpointHostHandler) return DisassociateAssetsRequest{Request: req, Input: input, Copy: c.DisassociateAssetsRequest} } // DisassociateAssetsRequest is the request type for the // DisassociateAssets API operation. type DisassociateAssetsRequest struct { *aws.Request Input *DisassociateAssetsInput Copy func(*DisassociateAssetsInput) DisassociateAssetsRequest } // Send marshals and sends the DisassociateAssets API request. func (r DisassociateAssetsRequest) Send(ctx context.Context) (*DisassociateAssetsResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &DisassociateAssetsResponse{ DisassociateAssetsOutput: r.Request.Data.(*DisassociateAssetsOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // DisassociateAssetsResponse is the response type for the // DisassociateAssets API operation. type DisassociateAssetsResponse struct { *DisassociateAssetsOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // DisassociateAssets request. func (r *DisassociateAssetsResponse) SDKResponseMetdata() *aws.Response { return r.response }