// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.

package route53

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"
)

// A request to get information about the traffic policy instances that you
// created by using the current AWS account.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesRequest
type ListTrafficPolicyInstancesInput struct {
	_ struct{} `type:"structure"`

	// If the value of IsTruncated in the previous response was true, you have more
	// traffic policy instances. To get more traffic policy instances, submit another
	// ListTrafficPolicyInstances request. For the value of HostedZoneId, specify
	// the value of HostedZoneIdMarker from the previous response, which is the
	// hosted zone ID of the first traffic policy instance in the next group of
	// traffic policy instances.
	//
	// If the value of IsTruncated in the previous response was false, there are
	// no more traffic policy instances to get.
	HostedZoneIdMarker *string `location:"querystring" locationName:"hostedzoneid" type:"string"`

	// The maximum number of traffic policy instances that you want Amazon Route
	// 53 to return in response to a ListTrafficPolicyInstances request. If you
	// have more than MaxItems traffic policy instances, the value of the IsTruncated
	// element in the response is true, and the values of HostedZoneIdMarker, TrafficPolicyInstanceNameMarker,
	// and TrafficPolicyInstanceTypeMarker represent the first traffic policy instance
	// in the next group of MaxItems traffic policy instances.
	MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"`

	// If the value of IsTruncated in the previous response was true, you have more
	// traffic policy instances. To get more traffic policy instances, submit another
	// ListTrafficPolicyInstances request. For the value of trafficpolicyinstancename,
	// specify the value of TrafficPolicyInstanceNameMarker from the previous response,
	// which is the name of the first traffic policy instance in the next group
	// of traffic policy instances.
	//
	// If the value of IsTruncated in the previous response was false, there are
	// no more traffic policy instances to get.
	TrafficPolicyInstanceNameMarker *string `location:"querystring" locationName:"trafficpolicyinstancename" type:"string"`

	// If the value of IsTruncated in the previous response was true, you have more
	// traffic policy instances. To get more traffic policy instances, submit another
	// ListTrafficPolicyInstances request. For the value of trafficpolicyinstancetype,
	// specify the value of TrafficPolicyInstanceTypeMarker from the previous response,
	// which is the type of the first traffic policy instance in the next group
	// of traffic policy instances.
	//
	// If the value of IsTruncated in the previous response was false, there are
	// no more traffic policy instances to get.
	TrafficPolicyInstanceTypeMarker RRType `location:"querystring" locationName:"trafficpolicyinstancetype" type:"string" enum:"true"`
}

// String returns the string representation
func (s ListTrafficPolicyInstancesInput) String() string {
	return awsutil.Prettify(s)
}

// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s ListTrafficPolicyInstancesInput) MarshalFields(e protocol.FieldEncoder) error {

	if s.HostedZoneIdMarker != nil {
		v := *s.HostedZoneIdMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.QueryTarget, "hostedzoneid", protocol.StringValue(v), metadata)
	}
	if s.MaxItems != nil {
		v := *s.MaxItems

		metadata := protocol.Metadata{}
		e.SetValue(protocol.QueryTarget, "maxitems", protocol.StringValue(v), metadata)
	}
	if s.TrafficPolicyInstanceNameMarker != nil {
		v := *s.TrafficPolicyInstanceNameMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.QueryTarget, "trafficpolicyinstancename", protocol.StringValue(v), metadata)
	}
	if len(s.TrafficPolicyInstanceTypeMarker) > 0 {
		v := s.TrafficPolicyInstanceTypeMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.QueryTarget, "trafficpolicyinstancetype", v, metadata)
	}
	return nil
}

// A complex type that contains the response information for the request.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesResponse
type ListTrafficPolicyInstancesOutput struct {
	_ struct{} `type:"structure"`

	// If IsTruncated is true, HostedZoneIdMarker is the ID of the hosted zone of
	// the first traffic policy instance that Route 53 will return if you submit
	// another ListTrafficPolicyInstances request.
	HostedZoneIdMarker *string `type:"string"`

	// A flag that indicates whether there are more traffic policy instances to
	// be listed. If the response was truncated, you can get more traffic policy
	// instances by calling ListTrafficPolicyInstances again and specifying the
	// values of the HostedZoneIdMarker, TrafficPolicyInstanceNameMarker, and TrafficPolicyInstanceTypeMarker
	// in the corresponding request parameters.
	//
	// IsTruncated is a required field
	IsTruncated *bool `type:"boolean" required:"true"`

	// The value that you specified for the MaxItems parameter in the call to ListTrafficPolicyInstances
	// that produced the current response.
	//
	// MaxItems is a required field
	MaxItems *string `type:"string" required:"true"`

	// If IsTruncated is true, TrafficPolicyInstanceNameMarker is the name of the
	// first traffic policy instance that Route 53 will return if you submit another
	// ListTrafficPolicyInstances request.
	TrafficPolicyInstanceNameMarker *string `type:"string"`

	// If IsTruncated is true, TrafficPolicyInstanceTypeMarker is the DNS type of
	// the resource record sets that are associated with the first traffic policy
	// instance that Amazon Route 53 will return if you submit another ListTrafficPolicyInstances
	// request.
	TrafficPolicyInstanceTypeMarker RRType `type:"string" enum:"true"`

	// A list that contains one TrafficPolicyInstance element for each traffic policy
	// instance that matches the elements in the request.
	//
	// TrafficPolicyInstances is a required field
	TrafficPolicyInstances []TrafficPolicyInstance `locationNameList:"TrafficPolicyInstance" type:"list" required:"true"`
}

// String returns the string representation
func (s ListTrafficPolicyInstancesOutput) String() string {
	return awsutil.Prettify(s)
}

// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s ListTrafficPolicyInstancesOutput) MarshalFields(e protocol.FieldEncoder) error {
	if s.HostedZoneIdMarker != nil {
		v := *s.HostedZoneIdMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.BodyTarget, "HostedZoneIdMarker", protocol.StringValue(v), metadata)
	}
	if s.IsTruncated != nil {
		v := *s.IsTruncated

		metadata := protocol.Metadata{}
		e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata)
	}
	if s.MaxItems != nil {
		v := *s.MaxItems

		metadata := protocol.Metadata{}
		e.SetValue(protocol.BodyTarget, "MaxItems", protocol.StringValue(v), metadata)
	}
	if s.TrafficPolicyInstanceNameMarker != nil {
		v := *s.TrafficPolicyInstanceNameMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.BodyTarget, "TrafficPolicyInstanceNameMarker", protocol.StringValue(v), metadata)
	}
	if len(s.TrafficPolicyInstanceTypeMarker) > 0 {
		v := s.TrafficPolicyInstanceTypeMarker

		metadata := protocol.Metadata{}
		e.SetValue(protocol.BodyTarget, "TrafficPolicyInstanceTypeMarker", v, metadata)
	}
	if len(s.TrafficPolicyInstances) > 0 {
		v := s.TrafficPolicyInstances

		metadata := protocol.Metadata{ListLocationName: "TrafficPolicyInstance"}
		ls0 := e.List(protocol.BodyTarget, "TrafficPolicyInstances", metadata)
		ls0.Start()
		for _, v1 := range v {
			ls0.ListAddFields(v1)
		}
		ls0.End()

	}
	return nil
}

const opListTrafficPolicyInstances = "ListTrafficPolicyInstances"

// ListTrafficPolicyInstancesRequest returns a request value for making API operation for
// Amazon Route 53.
//
// Gets information about the traffic policy instances that you created by using
// the current AWS account.
//
// After you submit an UpdateTrafficPolicyInstance request, there's a brief
// delay while Amazon Route 53 creates the resource record sets that are specified
// in the traffic policy definition. For more information, see the State response
// element.
//
// Route 53 returns a maximum of 100 items in each response. If you have a lot
// of traffic policy instances, you can use the MaxItems parameter to list them
// in groups of up to 100.
//
//    // Example sending a request using ListTrafficPolicyInstancesRequest.
//    req := client.ListTrafficPolicyInstancesRequest(params)
//    resp, err := req.Send(context.TODO())
//    if err == nil {
//        fmt.Println(resp)
//    }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstances
func (c *Client) ListTrafficPolicyInstancesRequest(input *ListTrafficPolicyInstancesInput) ListTrafficPolicyInstancesRequest {
	op := &aws.Operation{
		Name:       opListTrafficPolicyInstances,
		HTTPMethod: "GET",
		HTTPPath:   "/2013-04-01/trafficpolicyinstances",
	}

	if input == nil {
		input = &ListTrafficPolicyInstancesInput{}
	}

	req := c.newRequest(op, input, &ListTrafficPolicyInstancesOutput{})
	return ListTrafficPolicyInstancesRequest{Request: req, Input: input, Copy: c.ListTrafficPolicyInstancesRequest}
}

// ListTrafficPolicyInstancesRequest is the request type for the
// ListTrafficPolicyInstances API operation.
type ListTrafficPolicyInstancesRequest struct {
	*aws.Request
	Input *ListTrafficPolicyInstancesInput
	Copy  func(*ListTrafficPolicyInstancesInput) ListTrafficPolicyInstancesRequest
}

// Send marshals and sends the ListTrafficPolicyInstances API request.
func (r ListTrafficPolicyInstancesRequest) Send(ctx context.Context) (*ListTrafficPolicyInstancesResponse, error) {
	r.Request.SetContext(ctx)
	err := r.Request.Send()
	if err != nil {
		return nil, err
	}

	resp := &ListTrafficPolicyInstancesResponse{
		ListTrafficPolicyInstancesOutput: r.Request.Data.(*ListTrafficPolicyInstancesOutput),
		response:                         &aws.Response{Request: r.Request},
	}

	return resp, nil
}

// ListTrafficPolicyInstancesResponse is the response type for the
// ListTrafficPolicyInstances API operation.
type ListTrafficPolicyInstancesResponse struct {
	*ListTrafficPolicyInstancesOutput

	response *aws.Response
}

// SDKResponseMetdata returns the response metadata for the
// ListTrafficPolicyInstances request.
func (r *ListTrafficPolicyInstancesResponse) SDKResponseMetdata() *aws.Response {
	return r.response
}
