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, 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
73type CreateUpdatedImageOutput struct {
74
75	// Indicates whether a new image can be created.
76	CanUpdateImage bool
77
78	// Describes an image.
79	Image *types.Image
80
81	// Metadata pertaining to the operation's result.
82	ResultMetadata middleware.Metadata
83}
84
85func addOperationCreateUpdatedImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
86	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateUpdatedImage{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateUpdatedImage{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	if err = addSetLoggerMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
101		return err
102	}
103	if err = addResolveEndpointMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
107		return err
108	}
109	if err = addRetryMiddlewares(stack, options); err != nil {
110		return err
111	}
112	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
119		return err
120	}
121	if err = addClientUserAgent(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addOpCreateUpdatedImageValidationMiddleware(stack); err != nil {
131		return err
132	}
133	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUpdatedImage(options.Region), middleware.Before); err != nil {
134		return err
135	}
136	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addResponseErrorMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addRequestResponseLogging(stack, options); err != nil {
143		return err
144	}
145	return nil
146}
147
148func newServiceMetadataMiddleware_opCreateUpdatedImage(region string) *awsmiddleware.RegisterServiceMetadata {
149	return &awsmiddleware.RegisterServiceMetadata{
150		Region:        region,
151		ServiceID:     ServiceID,
152		SigningName:   "appstream",
153		OperationName: "CreateUpdatedImage",
154	}
155}
156