github.com/aavshr/aws-sdk-go@v1.41.3/service/marketplaceentitlementservice/api.go (about)

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