1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package licensemanager
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/licensemanager/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Checks out the specified license for offline use.
15func (c *Client) CheckoutBorrowLicense(ctx context.Context, params *CheckoutBorrowLicenseInput, optFns ...func(*Options)) (*CheckoutBorrowLicenseOutput, error) {
16	if params == nil {
17		params = &CheckoutBorrowLicenseInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CheckoutBorrowLicense", params, optFns, addOperationCheckoutBorrowLicenseMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CheckoutBorrowLicenseOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CheckoutBorrowLicenseInput struct {
31
32	// Unique, case-sensitive identifier that you provide to ensure the idempotency of
33	// the request.
34	//
35	// This member is required.
36	ClientToken *string
37
38	// Digital signature method. The possible value is JSON Web Signature (JWS)
39	// algorithm PS384. For more information, see RFC 7518 Digital Signature with
40	// RSASSA-PSS (https://tools.ietf.org/html/rfc7518#section-3.5).
41	//
42	// This member is required.
43	DigitalSignatureMethod types.DigitalSignatureMethod
44
45	// License entitlements. Partial checkouts are not supported.
46	//
47	// This member is required.
48	Entitlements []types.EntitlementData
49
50	// Amazon Resource Name (ARN) of the license. The license must use the borrow
51	// consumption configuration.
52	//
53	// This member is required.
54	LicenseArn *string
55
56	// Information about constraints.
57	CheckoutMetadata []types.Metadata
58
59	// Node ID.
60	NodeId *string
61}
62
63type CheckoutBorrowLicenseOutput struct {
64
65	// Information about constraints.
66	CheckoutMetadata []types.Metadata
67
68	// Allowed license entitlements.
69	EntitlementsAllowed []types.EntitlementData
70
71	// Date and time at which the license checkout expires.
72	Expiration *string
73
74	// Date and time at which the license checkout is issued.
75	IssuedAt *string
76
77	// Amazon Resource Name (ARN) of the license.
78	LicenseArn *string
79
80	// License consumption token.
81	LicenseConsumptionToken *string
82
83	// Node ID.
84	NodeId *string
85
86	// Signed token.
87	SignedToken *string
88
89	// Metadata pertaining to the operation's result.
90	ResultMetadata middleware.Metadata
91}
92
93func addOperationCheckoutBorrowLicenseMiddlewares(stack *middleware.Stack, options Options) (err error) {
94	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCheckoutBorrowLicense{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCheckoutBorrowLicense{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	if err = addSetLoggerMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
106		return err
107	}
108	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
109		return err
110	}
111	if err = addResolveEndpointMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
115		return err
116	}
117	if err = addRetryMiddlewares(stack, options); err != nil {
118		return err
119	}
120	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
121		return err
122	}
123	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
127		return err
128	}
129	if err = addClientUserAgent(stack); err != nil {
130		return err
131	}
132	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addOpCheckoutBorrowLicenseValidationMiddleware(stack); err != nil {
139		return err
140	}
141	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCheckoutBorrowLicense(options.Region), middleware.Before); err != nil {
142		return err
143	}
144	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addResponseErrorMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addRequestResponseLogging(stack, options); err != nil {
151		return err
152	}
153	return nil
154}
155
156func newServiceMetadataMiddleware_opCheckoutBorrowLicense(region string) *awsmiddleware.RegisterServiceMetadata {
157	return &awsmiddleware.RegisterServiceMetadata{
158		Region:        region,
159		ServiceID:     ServiceID,
160		SigningName:   "license-manager",
161		OperationName: "CheckoutBorrowLicense",
162	}
163}
164