Debian Codegraph @

service/marketplaceentitlementservice/api.go

raw
1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3 package marketplaceentitlementservice
4
5 import (
6 "fmt"
7 "time"
8
9 "github.com/aws/aws-sdk-go/aws"
10 "github.com/aws/aws-sdk-go/aws/awsutil"
11 "github.com/aws/aws-sdk-go/aws/request"
12 "github.com/aws/aws-sdk-go/private/protocol"
13 )
14
15 const opGetEntitlements = "GetEntitlements"
16
17 // GetEntitlementsRequest generates a "aws/request.Request" representing the
18 // client's request for the GetEntitlements operation. The "output" return
19 // value will be populated with the request's response once the request completes
20 // successfully.
21 //
22 // Use "Send" method on the returned Request to send the API call to the service.
23 // the "output" return value is not valid until after Send returns without error.
24 //
25 // See GetEntitlements for more information on using the GetEntitlements
26 // API call, and error handling.
27 //
28 // This method is useful when you want to inject custom logic or configuration
29 // into the SDK's request lifecycle. Such as custom headers, or retry logic.
30 //
31 // // Example sending a request using the GetEntitlementsRequest method.
32 // req, resp := client.GetEntitlementsRequest(params)
33 //
34 // err := req.Send()
35 // if err == nil { // resp is now filled
36 // fmt.Println(resp)
37 // }
38 //
39 // See also, https://docs.aws.amazon.com/goto/WebAPI/entitlement.marketplace-2017-01-11/GetEntitlements
40 func (c *MarketplaceEntitlementService) GetEntitlementsRequest(input *GetEntitlementsInput) (req *request.Request, output *GetEntitlementsOutput) {
41 op := &request.Operation{
42 Name: opGetEntitlements,
43 HTTPMethod: "POST",
44 HTTPPath: "/",
45 Paginator: &request.Paginator{
46 InputTokens: []string{"NextToken"},
47 OutputTokens: []string{"NextToken"},
48 LimitToken: "MaxResults",
49 TruncationToken: "",
50 },
51 }
52
53 if input == nil {
54 input = &GetEntitlementsInput{}
55 }
56
57 output = &GetEntitlementsOutput{}
58 req = c.newRequest(op, input, output)
59 return
60 }
61
62 // GetEntitlements API operation for AWS Marketplace Entitlement Service.
63 //
64 // GetEntitlements retrieves entitlement values for a given product. The results
65 // can be filtered based on customer identifier or product dimensions.
66 //
67 // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
68 // with awserr.Error's Code and Message methods to get detailed information about
69 // the error.
70 //
71 // See the AWS API reference guide for AWS Marketplace Entitlement Service's
72 // API operation GetEntitlements for usage and error information.
73 //
74 // Returned Error Types:
75 //
76 // - InvalidParameterException
77 // One or more parameters in your request was invalid.
78 //
79 // - ThrottlingException
80 // The calls to the GetEntitlements API are throttled.
81 //
82 // - InternalServiceErrorException
83 // An internal error has occurred. Retry your request. If the problem persists,
84 // post a message with details on the AWS forums.
85 //
86 // See also, https://docs.aws.amazon.com/goto/WebAPI/entitlement.marketplace-2017-01-11/GetEntitlements
87 func (c *MarketplaceEntitlementService) GetEntitlements(input *GetEntitlementsInput) (*GetEntitlementsOutput, error) {
88 req, out := c.GetEntitlementsRequest(input)
89 return out, req.Send()
90 }
91
92 // GetEntitlementsWithContext is the same as GetEntitlements with the addition of
93 // the ability to pass a context and additional request options.
94 //
95 // See GetEntitlements for details on how to use this API operation.
96 //
97 // The context must be non-nil and will be used for request cancellation. If
98 // the context is nil a panic will occur. In the future the SDK may create
99 // sub-contexts for http.Requests. See https://golang.org/pkg/context/
100 // for more information on using Contexts.
101 func (c *MarketplaceEntitlementService) GetEntitlementsWithContext(ctx aws.Context, input *GetEntitlementsInput, opts ...request.Option) (*GetEntitlementsOutput, error) {
102 req, out := c.GetEntitlementsRequest(input)
103 req.SetContext(ctx)
104 req.ApplyOptions(opts...)
105 return out, req.Send()
106 }
107
108 // GetEntitlementsPages iterates over the pages of a GetEntitlements operation,
109 // calling the "fn" function with the response data for each page. To stop
110 // iterating, return false from the fn function.
111 //
112 // See GetEntitlements method for more information on how to use this operation.
113 //
114 // Note: This operation can generate multiple requests to a service.
115 //
116 // // Example iterating over at most 3 pages of a GetEntitlements operation.
117 // pageNum := 0
118 // err := client.GetEntitlementsPages(params,
119 // func(page *marketplaceentitlementservice.GetEntitlementsOutput, lastPage bool) bool {
120 // pageNum++
121 // fmt.Println(page)
122 // return pageNum <= 3
123 // })
124 func (c *MarketplaceEntitlementService) GetEntitlementsPages(input *GetEntitlementsInput, fn func(*GetEntitlementsOutput, bool) bool) error {
125 return c.GetEntitlementsPagesWithContext(aws.BackgroundContext(), input, fn)
126 }
127
128 // GetEntitlementsPagesWithContext same as GetEntitlementsPages except
129 // it takes a Context and allows setting request options on the pages.
130 //
131 // The context must be non-nil and will be used for request cancellation. If
132 // the context is nil a panic will occur. In the future the SDK may create
133 // sub-contexts for http.Requests. See https://golang.org/pkg/context/
134 // for more information on using Contexts.
135 func (c *MarketplaceEntitlementService) GetEntitlementsPagesWithContext(ctx aws.Context, input *GetEntitlementsInput, fn func(*GetEntitlementsOutput, bool) bool, opts ...request.Option) error {
136 p := request.Pagination{
137 NewRequest: func() (*request.Request, error) {
138 var inCpy *GetEntitlementsInput
139 if input != nil {
140 tmp := *input
141 inCpy = &tmp
142 }
143 req, _ := c.GetEntitlementsRequest(inCpy)
144 req.SetContext(ctx)
145 req.ApplyOptions(opts...)
146 return req, nil
147 },
148 }
149
150 for p.Next() {
151 if !fn(p.Page().(*GetEntitlementsOutput), !p.HasNextPage()) {
152 break
153 }
154 }
155
156 return p.Err()
157 }
158
159 // An entitlement represents capacity in a product owned by the customer. For
160 // example, a customer might own some number of users or seats in an SaaS application
161 // or some amount of data capacity in a multi-tenant database.
162 type Entitlement struct {
163 _ struct{} `type:"structure"`
164
165 // The customer identifier is a handle to each unique customer in an application.
166 // Customer identifiers are obtained through the ResolveCustomer operation in
167 // AWS Marketplace Metering Service.
168 CustomerIdentifier *string `type:"string"`
169
170 // The dimension for which the given entitlement applies. Dimensions represent
171 // categories of capacity in a product and are specified when the product is
172 // listed in AWS Marketplace.
173 Dimension *string `type:"string"`
174
175 // The expiration date represents the minimum date through which this entitlement
176 // is expected to remain valid. For contractual products listed on AWS Marketplace,
177 // the expiration date is the date at which the customer will renew or cancel
178 // their contract. Customers who are opting to renew their contract will still
179 // have entitlements with an expiration date.
180 ExpirationDate *time.Time `type:"timestamp"`
181
182 // The product code for which the given entitlement applies. Product codes are
183 // provided by AWS Marketplace when the product listing is created.
184 ProductCode *string `min:"1" type:"string"`
185
186 // The EntitlementValue represents the amount of capacity that the customer
187 // is entitled to for the product.
188 Value *EntitlementValue `type:"structure"`
189 }
190
191 // String returns the string representation.
192 //
193 // API parameter values that are decorated as "sensitive" in the API will not
194 // be included in the string output. The member name will be present, but the
195 // value will be replaced with "sensitive".
196 func (s Entitlement) String() string {
197 return awsutil.Prettify(s)
198 }
199
200 // GoString returns the string representation.
201 //
202 // API parameter values that are decorated as "sensitive" in the API will not
203 // be included in the string output. The member name will be present, but the
204 // value will be replaced with "sensitive".
205 func (s Entitlement) GoString() string {
206 return s.String()
207 }
208
209 // SetCustomerIdentifier sets the CustomerIdentifier field's value.
210 func (s *Entitlement) SetCustomerIdentifier(v string) *Entitlement {
211 s.CustomerIdentifier = &v
212 return s
213 }
214
215 // SetDimension sets the Dimension field's value.
216 func (s *Entitlement) SetDimension(v string) *Entitlement {
217 s.Dimension = &v
218 return s
219 }
220
221 // SetExpirationDate sets the ExpirationDate field's value.
222 func (s *Entitlement) SetExpirationDate(v time.Time) *Entitlement {
223 s.ExpirationDate = &v
224 return s
225 }
226
227 // SetProductCode sets the ProductCode field's value.
228 func (s *Entitlement) SetProductCode(v string) *Entitlement {
229 s.ProductCode = &v
230 return s
231 }
232
233 // SetValue sets the Value field's value.
234 func (s *Entitlement) SetValue(v *EntitlementValue) *Entitlement {
235 s.Value = v
236 return s
237 }
238
239 // The EntitlementValue represents the amount of capacity that the customer
240 // is entitled to for the product.
241 type EntitlementValue struct {
242 _ struct{} `type:"structure"`
243
244 // The BooleanValue field will be populated with a boolean value when the entitlement
245 // is a boolean type. Otherwise, the field will not be set.
246 BooleanValue *bool `type:"boolean"`
247
248 // The DoubleValue field will be populated with a double value when the entitlement
249 // is a double type. Otherwise, the field will not be set.
250 DoubleValue *float64 `type:"double"`
251
252 // The IntegerValue field will be populated with an integer value when the entitlement
253 // is an integer type. Otherwise, the field will not be set.
254 IntegerValue *int64 `type:"integer"`
255
256 // The StringValue field will be populated with a string value when the entitlement
257 // is a string type. Otherwise, the field will not be set.
258 StringValue *string `type:"string"`
259 }
260
261 // String returns the string representation.
262 //
263 // API parameter values that are decorated as "sensitive" in the API will not
264 // be included in the string output. The member name will be present, but the
265 // value will be replaced with "sensitive".
266 func (s EntitlementValue) String() string {
267 return awsutil.Prettify(s)
268 }
269
270 // GoString returns the string representation.
271 //
272 // API parameter values that are decorated as "sensitive" in the API will not
273 // be included in the string output. The member name will be present, but the
274 // value will be replaced with "sensitive".
275 func (s EntitlementValue) GoString() string {
276 return s.String()
277 }
278
279 // SetBooleanValue sets the BooleanValue field's value.
280 func (s *EntitlementValue) SetBooleanValue(v bool) *EntitlementValue {
281 s.BooleanValue = &v
282 return s
283 }
284
285 // SetDoubleValue sets the DoubleValue field's value.
286 func (s *EntitlementValue) SetDoubleValue(v float64) *EntitlementValue {
287 s.DoubleValue = &v
288 return s
289 }
290
291 // SetIntegerValue sets the IntegerValue field's value.
292 func (s *EntitlementValue) SetIntegerValue(v int64) *EntitlementValue {
293 s.IntegerValue = &v
294 return s
295 }
296
297 // SetStringValue sets the StringValue field's value.
298 func (s *EntitlementValue) SetStringValue(v string) *EntitlementValue {
299 s.StringValue = &v
300 return s
301 }
302
303 // The GetEntitlementsRequest contains parameters for the GetEntitlements operation.
304 type GetEntitlementsInput struct {
305 _ struct{} `type:"structure"`
306
307 // Filter is used to return entitlements for a specific customer or for a specific
308 // dimension. Filters are described as keys mapped to a lists of values. Filtered
309 // requests are unioned for each value in the value list, and then intersected
310 // for each filter key.
311 Filter map[string][]*string `type:"map"`
312
313 // The maximum number of items to retrieve from the GetEntitlements operation.
314 // For pagination, use the NextToken field in subsequent calls to GetEntitlements.
315 MaxResults *int64 `min:"1" type:"integer"`
316
317 // For paginated calls to GetEntitlements, pass the NextToken from the previous
318 // GetEntitlementsResult.
319 NextToken *string `type:"string"`
320
321 // Product code is used to uniquely identify a product in AWS Marketplace. The
322 // product code will be provided by AWS Marketplace when the product listing
323 // is created.
324 //
325 // ProductCode is a required field
326 ProductCode *string `min:"1" type:"string" required:"true"`
327 }
328
329 // String returns the string representation.
330 //
331 // API parameter values that are decorated as "sensitive" in the API will not
332 // be included in the string output. The member name will be present, but the
333 // value will be replaced with "sensitive".
334 func (s GetEntitlementsInput) String() string {
335 return awsutil.Prettify(s)
336 }
337
338 // GoString returns the string representation.
339 //
340 // API parameter values that are decorated as "sensitive" in the API will not
341 // be included in the string output. The member name will be present, but the
342 // value will be replaced with "sensitive".
343 func (s GetEntitlementsInput) GoString() string {
344 return s.String()
345 }
346
347 // Validate inspects the fields of the type to determine if they are valid.
348 func (s *GetEntitlementsInput) Validate() error {
349 invalidParams := request.ErrInvalidParams{Context: "GetEntitlementsInput"}
350 if s.MaxResults != nil && *s.MaxResults < 1 {
351 invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1))
352 }
353 if s.ProductCode == nil {
354 invalidParams.Add(request.NewErrParamRequired("ProductCode"))
355 }
356 if s.ProductCode != nil && len(*s.ProductCode) < 1 {
357 invalidParams.Add(request.NewErrParamMinLen("ProductCode", 1))
358 }
359
360 if invalidParams.Len() > 0 {
361 return invalidParams
362 }
363 return nil
364 }
365
366 // SetFilter sets the Filter field's value.
367 func (s *GetEntitlementsInput) SetFilter(v map[string][]*string) *GetEntitlementsInput {
368 s.Filter = v
369 return s
370 }
371
372 // SetMaxResults sets the MaxResults field's value.
373 func (s *GetEntitlementsInput) SetMaxResults(v int64) *GetEntitlementsInput {
374 s.MaxResults = &v
375 return s
376 }
377
378 // SetNextToken sets the NextToken field's value.
379 func (s *GetEntitlementsInput) SetNextToken(v string) *GetEntitlementsInput {
380 s.NextToken = &v
381 return s
382 }
383
384 // SetProductCode sets the ProductCode field's value.
385 func (s *GetEntitlementsInput) SetProductCode(v string) *GetEntitlementsInput {
386 s.ProductCode = &v
387 return s
388 }
389
390 // The GetEntitlementsRequest contains results from the GetEntitlements operation.
391 type GetEntitlementsOutput struct {
392 _ struct{} `type:"structure"`
393
394 // The set of entitlements found through the GetEntitlements operation. If the
395 // result contains an empty set of entitlements, NextToken might still be present
396 // and should be used.
397 Entitlements []*Entitlement `type:"list"`
398
399 // For paginated results, use NextToken in subsequent calls to GetEntitlements.
400 // If the result contains an empty set of entitlements, NextToken might still
401 // be present and should be used.
402 NextToken *string `type:"string"`
403 }
404
405 // String returns the string representation.
406 //
407 // API parameter values that are decorated as "sensitive" in the API will not
408 // be included in the string output. The member name will be present, but the
409 // value will be replaced with "sensitive".
410 func (s GetEntitlementsOutput) String() string {
411 return awsutil.Prettify(s)
412 }
413
414 // GoString returns the string representation.
415 //
416 // API parameter values that are decorated as "sensitive" in the API will not
417 // be included in the string output. The member name will be present, but the
418 // value will be replaced with "sensitive".
419 func (s GetEntitlementsOutput) GoString() string {
420 return s.String()
421 }
422
423 // SetEntitlements sets the Entitlements field's value.
424 func (s *GetEntitlementsOutput) SetEntitlements(v []*Entitlement) *GetEntitlementsOutput {
425 s.Entitlements = v
426 return s
427 }
428
429 // SetNextToken sets the NextToken field's value.
430 func (s *GetEntitlementsOutput) SetNextToken(v string) *GetEntitlementsOutput {
431 s.NextToken = &v
432 return s
433 }
434
435 // An internal error has occurred. Retry your request. If the problem persists,
436 // post a message with details on the AWS forums.
437 type InternalServiceErrorException struct {
438 _ struct{} `type:"structure"`
439 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
440
441 Message_ *string `locationName:"message" type:"string"`
442 }
443
444 // String returns the string representation.
445 //
446 // API parameter values that are decorated as "sensitive" in the API will not
447 // be included in the string output. The member name will be present, but the
448 // value will be replaced with "sensitive".
449 func (s InternalServiceErrorException) String() string {
450 return awsutil.Prettify(s)
451 }
452
453 // GoString returns the string representation.
454 //
455 // API parameter values that are decorated as "sensitive" in the API will not
456 // be included in the string output. The member name will be present, but the
457 // value will be replaced with "sensitive".
458 func (s InternalServiceErrorException) GoString() string {
459 return s.String()
460 }
461
462 func newErrorInternalServiceErrorException(v protocol.ResponseMetadata) error {
463 return &InternalServiceErrorException{
464 RespMetadata: v,
465 }
466 }
467
468 // Code returns the exception type name.
469 func (s *InternalServiceErrorException) Code() string {
470 return "InternalServiceErrorException"
471 }
472
473 // Message returns the exception's message.
474 func (s *InternalServiceErrorException) Message() string {
475 if s.Message_ != nil {
476 return *s.Message_
477 }
478 return ""
479 }
480
481 // OrigErr always returns nil, satisfies awserr.Error interface.
482 func (s *InternalServiceErrorException) OrigErr() error {
483 return nil
484 }
485
486 func (s *InternalServiceErrorException) Error() string {
487 return fmt.Sprintf("%s: %s", s.Code(), s.Message())
488 }
489
490 // Status code returns the HTTP status code for the request's response error.
491 func (s *InternalServiceErrorException) StatusCode() int {
492 return s.RespMetadata.StatusCode
493 }
494
495 // RequestID returns the service's response RequestID for request.
496 func (s *InternalServiceErrorException) RequestID() string {
497 return s.RespMetadata.RequestID
498 }
499
500 // One or more parameters in your request was invalid.
501 type InvalidParameterException struct {
502 _ struct{} `type:"structure"`
503 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
504
505 Message_ *string `locationName:"message" type:"string"`
506 }
507
508 // String returns the string representation.
509 //
510 // API parameter values that are decorated as "sensitive" in the API will not
511 // be included in the string output. The member name will be present, but the
512 // value will be replaced with "sensitive".
513 func (s InvalidParameterException) String() string {
514 return awsutil.Prettify(s)
515 }
516
517 // GoString returns the string representation.
518 //
519 // API parameter values that are decorated as "sensitive" in the API will not
520 // be included in the string output. The member name will be present, but the
521 // value will be replaced with "sensitive".
522 func (s InvalidParameterException) GoString() string {
523 return s.String()
524 }
525
526 func newErrorInvalidParameterException(v protocol.ResponseMetadata) error {
527 return &InvalidParameterException{
528 RespMetadata: v,
529 }
530 }
531
532 // Code returns the exception type name.
533 func (s *InvalidParameterException) Code() string {
534 return "InvalidParameterException"
535 }
536
537 // Message returns the exception's message.
538 func (s *InvalidParameterException) Message() string {
539 if s.Message_ != nil {
540 return *s.Message_
541 }
542 return ""
543 }
544
545 // OrigErr always returns nil, satisfies awserr.Error interface.
546 func (s *InvalidParameterException) OrigErr() error {
547 return nil
548 }
549
550 func (s *InvalidParameterException) Error() string {
551 return fmt.Sprintf("%s: %s", s.Code(), s.Message())
552 }
553
554 // Status code returns the HTTP status code for the request's response error.
555 func (s *InvalidParameterException) StatusCode() int {
556 return s.RespMetadata.StatusCode
557 }
558
559 // RequestID returns the service's response RequestID for request.
560 func (s *InvalidParameterException) RequestID() string {
561 return s.RespMetadata.RequestID
562 }
563
564 // The calls to the GetEntitlements API are throttled.
565 type ThrottlingException struct {
566 _ struct{} `type:"structure"`
567 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
568
569 Message_ *string `locationName:"message" type:"string"`
570 }
571
572 // String returns the string representation.
573 //
574 // API parameter values that are decorated as "sensitive" in the API will not
575 // be included in the string output. The member name will be present, but the
576 // value will be replaced with "sensitive".
577 func (s ThrottlingException) String() string {
578 return awsutil.Prettify(s)
579 }
580
581 // GoString returns the string representation.
582 //
583 // API parameter values that are decorated as "sensitive" in the API will not
584 // be included in the string output. The member name will be present, but the
585 // value will be replaced with "sensitive".
586 func (s ThrottlingException) GoString() string {
587 return s.String()
588 }
589
590 func newErrorThrottlingException(v protocol.ResponseMetadata) error {
591 return &ThrottlingException{
592 RespMetadata: v,
593 }
594 }
595
596 // Code returns the exception type name.
597 func (s *ThrottlingException) Code() string {
598 return "ThrottlingException"
599 }
600
601 // Message returns the exception's message.
602 func (s *ThrottlingException) Message() string {
603 if s.Message_ != nil {
604 return *s.Message_
605 }
606 return ""
607 }
608
609 // OrigErr always returns nil, satisfies awserr.Error interface.
610 func (s *ThrottlingException) OrigErr() error {
611 return nil
612 }
613
614 func (s *ThrottlingException) Error() string {
615 return fmt.Sprintf("%s: %s", s.Code(), s.Message())
616 }
617
618 // Status code returns the HTTP status code for the request's response error.
619 func (s *ThrottlingException) StatusCode() int {
620 return s.RespMetadata.StatusCode
621 }
622
623 // RequestID returns the service's response RequestID for request.
624 func (s *ThrottlingException) RequestID() string {
625 return s.RespMetadata.RequestID
626 }
627
628 const (
629 // GetEntitlementFilterNameCustomerIdentifier is a GetEntitlementFilterName enum value
630 GetEntitlementFilterNameCustomerIdentifier = "CUSTOMER_IDENTIFIER"
631
632 // GetEntitlementFilterNameDimension is a GetEntitlementFilterName enum value
633 GetEntitlementFilterNameDimension = "DIMENSION"
634 )
635
636 // GetEntitlementFilterName_Values returns all elements of the GetEntitlementFilterName enum
637 func GetEntitlementFilterName_Values() []string {
638 return []string{
639 GetEntitlementFilterNameCustomerIdentifier,
640 GetEntitlementFilterNameDimension,
641 }
642 }