1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package mediapackagevod
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/mediapackagevod/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new MediaPackage VOD Asset resource.
15func (c *Client) CreateAsset(ctx context.Context, params *CreateAssetInput, optFns ...func(*Options)) (*CreateAssetOutput, error) {
16	if params == nil {
17		params = &CreateAssetInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateAsset", params, optFns, addOperationCreateAssetMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateAssetOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// A new MediaPackage VOD Asset configuration.
31type CreateAssetInput struct {
32
33	// The unique identifier for the Asset.
34	//
35	// This member is required.
36	Id *string
37
38	// The ID of the PackagingGroup for the Asset.
39	//
40	// This member is required.
41	PackagingGroupId *string
42
43	// ARN of the source object in S3.
44	//
45	// This member is required.
46	SourceArn *string
47
48	// The IAM role ARN used to access the source S3 bucket.
49	//
50	// This member is required.
51	SourceRoleArn *string
52
53	// The resource ID to include in SPEKE key requests.
54	ResourceId *string
55
56	// A collection of tags associated with a resource
57	Tags map[string]string
58}
59
60type CreateAssetOutput struct {
61
62	// The ARN of the Asset.
63	Arn *string
64
65	// The time the Asset was initially submitted for Ingest.
66	CreatedAt *string
67
68	// The list of egress endpoints available for the Asset.
69	EgressEndpoints []types.EgressEndpoint
70
71	// The unique identifier for the Asset.
72	Id *string
73
74	// The ID of the PackagingGroup for the Asset.
75	PackagingGroupId *string
76
77	// The resource ID to include in SPEKE key requests.
78	ResourceId *string
79
80	// ARN of the source object in S3.
81	SourceArn *string
82
83	// The IAM role_arn used to access the source S3 bucket.
84	SourceRoleArn *string
85
86	// A collection of tags associated with a resource
87	Tags map[string]string
88
89	// Metadata pertaining to the operation's result.
90	ResultMetadata middleware.Metadata
91}
92
93func addOperationCreateAssetMiddlewares(stack *middleware.Stack, options Options) (err error) {
94	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAsset{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAsset{}, 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 = addOpCreateAssetValidationMiddleware(stack); err != nil {
139		return err
140	}
141	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAsset(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_opCreateAsset(region string) *awsmiddleware.RegisterServiceMetadata {
157	return &awsmiddleware.RegisterServiceMetadata{
158		Region:        region,
159		ServiceID:     ServiceID,
160		SigningName:   "mediapackage-vod",
161		OperationName: "CreateAsset",
162	}
163}
164