// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codeartifact 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 DeleteDomainInput struct { _ struct{} `type:"structure"` // The name of the domain to delete. // // Domain is a required field Domain *string `location:"querystring" locationName:"domain" min:"2" type:"string" required:"true"` // The 12-digit account number of the AWS account that owns the domain. It does // not include dashes or spaces. DomainOwner *string `location:"querystring" locationName:"domain-owner" min:"12" type:"string"` } // String returns the string representation func (s DeleteDomainInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *DeleteDomainInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "DeleteDomainInput"} if s.Domain == nil { invalidParams.Add(aws.NewErrParamRequired("Domain")) } if s.Domain != nil && len(*s.Domain) < 2 { invalidParams.Add(aws.NewErrParamMinLen("Domain", 2)) } if s.DomainOwner != nil && len(*s.DomainOwner) < 12 { invalidParams.Add(aws.NewErrParamMinLen("DomainOwner", 12)) } if invalidParams.Len() > 0 { return invalidParams } return nil } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s DeleteDomainInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if s.Domain != nil { v := *s.Domain metadata := protocol.Metadata{} e.SetValue(protocol.QueryTarget, "domain", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.DomainOwner != nil { v := *s.DomainOwner metadata := protocol.Metadata{} e.SetValue(protocol.QueryTarget, "domain-owner", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } type DeleteDomainOutput struct { _ struct{} `type:"structure"` // Contains information about the deleted domain after processing the request. Domain *DomainDescription `locationName:"domain" type:"structure"` } // String returns the string representation func (s DeleteDomainOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s DeleteDomainOutput) MarshalFields(e protocol.FieldEncoder) error { if s.Domain != nil { v := s.Domain metadata := protocol.Metadata{} e.SetFields(protocol.BodyTarget, "domain", v, metadata) } return nil } const opDeleteDomain = "DeleteDomain" // DeleteDomainRequest returns a request value for making API operation for // CodeArtifact. // // Deletes a domain. You cannot delete a domain that contains repositories. // If you want to delete a domain with repositories, first delete its repositories. // // // Example sending a request using DeleteDomainRequest. // req := client.DeleteDomainRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/codeartifact-2018-09-22/DeleteDomain func (c *Client) DeleteDomainRequest(input *DeleteDomainInput) DeleteDomainRequest { op := &aws.Operation{ Name: opDeleteDomain, HTTPMethod: "DELETE", HTTPPath: "/v1/domain", } if input == nil { input = &DeleteDomainInput{} } req := c.newRequest(op, input, &DeleteDomainOutput{}) return DeleteDomainRequest{Request: req, Input: input, Copy: c.DeleteDomainRequest} } // DeleteDomainRequest is the request type for the // DeleteDomain API operation. type DeleteDomainRequest struct { *aws.Request Input *DeleteDomainInput Copy func(*DeleteDomainInput) DeleteDomainRequest } // Send marshals and sends the DeleteDomain API request. func (r DeleteDomainRequest) Send(ctx context.Context) (*DeleteDomainResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &DeleteDomainResponse{ DeleteDomainOutput: r.Request.Data.(*DeleteDomainOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // DeleteDomainResponse is the response type for the // DeleteDomain API operation. type DeleteDomainResponse struct { *DeleteDomainOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // DeleteDomain request. func (r *DeleteDomainResponse) SDKResponseMetdata() *aws.Response { return r.response }