1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package appstream
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/appstream/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new image with the latest Windows operating system updates, driver
15// updates, and AppStream 2.0 agent software. For more information, see the "Update
16// an Image by Using Managed AppStream 2.0 Image Updates" section in Administer
17// Your AppStream 2.0 Images
18// (https://docs.aws.amazon.com/appstream2/latest/developerguide/administer-images.html),
19// in the Amazon AppStream 2.0 Administration Guide.
20func (c *Client) CreateUpdatedImage(ctx context.Context, params *CreateUpdatedImageInput, optFns ...func(*Options)) (*CreateUpdatedImageOutput, error) {
21	if params == nil {
22		params = &CreateUpdatedImageInput{}
23	}
24
25	result, metadata, err := c.invokeOperation(ctx, "CreateUpdatedImage", params, optFns, c.addOperationCreateUpdatedImageMiddlewares)
26	if err != nil {
27		return nil, err
28	}
29
30	out := result.(*CreateUpdatedImageOutput)
31	out.ResultMetadata = metadata
32	return out, nil
33}
34
35type CreateUpdatedImageInput struct {
36
37	// The name of the image to update.
38	//
39	// This member is required.
40	ExistingImageName *string
41
42	// The name of the new image. The name must be unique within the AWS account and
43	// Region.
44	//
45	// This member is required.
46	NewImageName *string
47
48	// Indicates whether to display the status of image update availability before
49	// AppStream 2.0 initiates the process of creating a new updated image. If this
50	// value is set to true, AppStream 2.0 displays whether image updates are
51	// available. If this value is set to false, AppStream 2.0 initiates the process of
52	// creating a new updated image without displaying whether image updates are
53	// available.
54	DryRun bool
55
56	// The description to display for the new image.
57	NewImageDescription *string
58
59	// The name to display for the new image.
60	NewImageDisplayName *string
61
62	// The tags to associate with the new image. A tag is a key-value pair, and the
63	// value is optional. For example, Environment=Test. If you do not specify a value,
64	// Environment=. Generally allowed characters are: letters, numbers, and spaces
65	// representable in UTF-8, and the following special characters: _ . : / = + \ - @
66	// If you do not specify a value, the value is set to an empty string. For more
67	// information about tags, see Tagging Your Resources
68	// (https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html)
69	// in the Amazon AppStream 2.0 Administration Guide.
70	NewImageTags map[string]string
71
72	noSmithyDocumentSerde
73}
74
75type CreateUpdatedImageOutput struct {
76
77	// Indicates whether a new image can be created.
78	CanUpdateImage bool
79
80	// Describes an image.
81	Image *types.Image
82
83	// Metadata pertaining to the operation's result.
84	ResultMetadata middleware.Metadata
85
86	noSmithyDocumentSerde
87}
88
89func (c *Client) addOperationCreateUpdatedImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
90	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateUpdatedImage{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateUpdatedImage{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	if err = addSetLoggerMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
105		return err
106	}
107	if err = addResolveEndpointMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
111		return err
112	}
113	if err = addRetryMiddlewares(stack, options); err != nil {
114		return err
115	}
116	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
120		return err
121	}
122	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
123		return err
124	}
125	if err = addClientUserAgent(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addOpCreateUpdatedImageValidationMiddleware(stack); err != nil {
135		return err
136	}
137	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUpdatedImage(options.Region), middleware.Before); err != nil {
138		return err
139	}
140	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addResponseErrorMiddleware(stack); err != nil {
144		return err
145	}
146	if err = addRequestResponseLogging(stack, options); err != nil {
147		return err
148	}
149	return nil
150}
151
152func newServiceMetadataMiddleware_opCreateUpdatedImage(region string) *awsmiddleware.RegisterServiceMetadata {
153	return &awsmiddleware.RegisterServiceMetadata{
154		Region:        region,
155		ServiceID:     ServiceID,
156		SigningName:   "appstream",
157		OperationName: "CreateUpdatedImage",
158	}
159}
160