1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package storagegateway 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/storagegateway/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Returns a list of virtual tape recovery points that are available for the 16// specified tape gateway. A recovery point is a point-in-time view of a virtual 17// tape at which all the data on the virtual tape is consistent. If your gateway 18// crashes, virtual tapes that have recovery points can be recovered to a new 19// gateway. This operation is only supported in the tape gateway type. 20func (c *Client) DescribeTapeRecoveryPoints(ctx context.Context, params *DescribeTapeRecoveryPointsInput, optFns ...func(*Options)) (*DescribeTapeRecoveryPointsOutput, error) { 21 if params == nil { 22 params = &DescribeTapeRecoveryPointsInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "DescribeTapeRecoveryPoints", params, optFns, addOperationDescribeTapeRecoveryPointsMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*DescribeTapeRecoveryPointsOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35// DescribeTapeRecoveryPointsInput 36type DescribeTapeRecoveryPointsInput struct { 37 38 // The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to 39 // return a list of gateways for your account and AWS Region. 40 // 41 // This member is required. 42 GatewayARN *string 43 44 // Specifies that the number of virtual tape recovery points that are described be 45 // limited to the specified number. 46 Limit *int32 47 48 // An opaque string that indicates the position at which to begin describing the 49 // virtual tape recovery points. 50 Marker *string 51} 52 53// DescribeTapeRecoveryPointsOutput 54type DescribeTapeRecoveryPointsOutput struct { 55 56 // The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to 57 // return a list of gateways for your account and AWS Region. 58 GatewayARN *string 59 60 // An opaque string that indicates the position at which the virtual tape recovery 61 // points that were listed for description ended. Use this marker in your next 62 // request to list the next set of virtual tape recovery points in the list. If 63 // there are no more recovery points to describe, this field does not appear in the 64 // response. 65 Marker *string 66 67 // An array of TapeRecoveryPointInfos that are available for the specified gateway. 68 TapeRecoveryPointInfos []types.TapeRecoveryPointInfo 69 70 // Metadata pertaining to the operation's result. 71 ResultMetadata middleware.Metadata 72} 73 74func addOperationDescribeTapeRecoveryPointsMiddlewares(stack *middleware.Stack, options Options) (err error) { 75 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeTapeRecoveryPoints{}, middleware.After) 76 if err != nil { 77 return err 78 } 79 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeTapeRecoveryPoints{}, middleware.After) 80 if err != nil { 81 return err 82 } 83 if err = addSetLoggerMiddleware(stack, options); err != nil { 84 return err 85 } 86 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 87 return err 88 } 89 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 90 return err 91 } 92 if err = addResolveEndpointMiddleware(stack, options); err != nil { 93 return err 94 } 95 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 96 return err 97 } 98 if err = addRetryMiddlewares(stack, options); err != nil { 99 return err 100 } 101 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 102 return err 103 } 104 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 105 return err 106 } 107 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 108 return err 109 } 110 if err = addClientUserAgent(stack); err != nil { 111 return err 112 } 113 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 114 return err 115 } 116 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 117 return err 118 } 119 if err = addOpDescribeTapeRecoveryPointsValidationMiddleware(stack); err != nil { 120 return err 121 } 122 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeTapeRecoveryPoints(options.Region), middleware.Before); err != nil { 123 return err 124 } 125 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addResponseErrorMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addRequestResponseLogging(stack, options); err != nil { 132 return err 133 } 134 return nil 135} 136 137// DescribeTapeRecoveryPointsAPIClient is a client that implements the 138// DescribeTapeRecoveryPoints operation. 139type DescribeTapeRecoveryPointsAPIClient interface { 140 DescribeTapeRecoveryPoints(context.Context, *DescribeTapeRecoveryPointsInput, ...func(*Options)) (*DescribeTapeRecoveryPointsOutput, error) 141} 142 143var _ DescribeTapeRecoveryPointsAPIClient = (*Client)(nil) 144 145// DescribeTapeRecoveryPointsPaginatorOptions is the paginator options for 146// DescribeTapeRecoveryPoints 147type DescribeTapeRecoveryPointsPaginatorOptions struct { 148 // Specifies that the number of virtual tape recovery points that are described be 149 // limited to the specified number. 150 Limit int32 151 152 // Set to true if pagination should stop if the service returns a pagination token 153 // that matches the most recent token provided to the service. 154 StopOnDuplicateToken bool 155} 156 157// DescribeTapeRecoveryPointsPaginator is a paginator for 158// DescribeTapeRecoveryPoints 159type DescribeTapeRecoveryPointsPaginator struct { 160 options DescribeTapeRecoveryPointsPaginatorOptions 161 client DescribeTapeRecoveryPointsAPIClient 162 params *DescribeTapeRecoveryPointsInput 163 nextToken *string 164 firstPage bool 165} 166 167// NewDescribeTapeRecoveryPointsPaginator returns a new 168// DescribeTapeRecoveryPointsPaginator 169func NewDescribeTapeRecoveryPointsPaginator(client DescribeTapeRecoveryPointsAPIClient, params *DescribeTapeRecoveryPointsInput, optFns ...func(*DescribeTapeRecoveryPointsPaginatorOptions)) *DescribeTapeRecoveryPointsPaginator { 170 options := DescribeTapeRecoveryPointsPaginatorOptions{} 171 if params.Limit != nil { 172 options.Limit = *params.Limit 173 } 174 175 for _, fn := range optFns { 176 fn(&options) 177 } 178 179 if params == nil { 180 params = &DescribeTapeRecoveryPointsInput{} 181 } 182 183 return &DescribeTapeRecoveryPointsPaginator{ 184 options: options, 185 client: client, 186 params: params, 187 firstPage: true, 188 } 189} 190 191// HasMorePages returns a boolean indicating whether more pages are available 192func (p *DescribeTapeRecoveryPointsPaginator) HasMorePages() bool { 193 return p.firstPage || p.nextToken != nil 194} 195 196// NextPage retrieves the next DescribeTapeRecoveryPoints page. 197func (p *DescribeTapeRecoveryPointsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeTapeRecoveryPointsOutput, error) { 198 if !p.HasMorePages() { 199 return nil, fmt.Errorf("no more pages available") 200 } 201 202 params := *p.params 203 params.Marker = p.nextToken 204 205 var limit *int32 206 if p.options.Limit > 0 { 207 limit = &p.options.Limit 208 } 209 params.Limit = limit 210 211 result, err := p.client.DescribeTapeRecoveryPoints(ctx, ¶ms, optFns...) 212 if err != nil { 213 return nil, err 214 } 215 p.firstPage = false 216 217 prevToken := p.nextToken 218 p.nextToken = result.Marker 219 220 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 221 p.nextToken = nil 222 } 223 224 return result, nil 225} 226 227func newServiceMetadataMiddleware_opDescribeTapeRecoveryPoints(region string) *awsmiddleware.RegisterServiceMetadata { 228 return &awsmiddleware.RegisterServiceMetadata{ 229 Region: region, 230 ServiceID: ServiceID, 231 SigningName: "storagegateway", 232 OperationName: "DescribeTapeRecoveryPoints", 233 } 234} 235