1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package sms
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/sms/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an application. An application consists of one or more server groups.
15// Each server group contain one or more servers.
16func (c *Client) CreateApp(ctx context.Context, params *CreateAppInput, optFns ...func(*Options)) (*CreateAppOutput, error) {
17	if params == nil {
18		params = &CreateAppInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateApp", params, optFns, addOperationCreateAppMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateAppOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type CreateAppInput struct {
32
33	// A unique, case-sensitive identifier that you provide to ensure the idempotency
34	// of application creation.
35	ClientToken *string
36
37	// The description of the new application
38	Description *string
39
40	// The name of the new application.
41	Name *string
42
43	// The name of the service role in the customer's account to be used by AWS SMS.
44	RoleName *string
45
46	// The server groups to include in the application.
47	ServerGroups []types.ServerGroup
48
49	// The tags to be associated with the application.
50	Tags []types.Tag
51}
52
53type CreateAppOutput struct {
54
55	// A summary description of the application.
56	AppSummary *types.AppSummary
57
58	// The server groups included in the application.
59	ServerGroups []types.ServerGroup
60
61	// The tags associated with the application.
62	Tags []types.Tag
63
64	// Metadata pertaining to the operation's result.
65	ResultMetadata middleware.Metadata
66}
67
68func addOperationCreateAppMiddlewares(stack *middleware.Stack, options Options) (err error) {
69	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateApp{}, middleware.After)
70	if err != nil {
71		return err
72	}
73	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateApp{}, middleware.After)
74	if err != nil {
75		return err
76	}
77	if err = addSetLoggerMiddleware(stack, options); err != nil {
78		return err
79	}
80	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
81		return err
82	}
83	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
84		return err
85	}
86	if err = addResolveEndpointMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
90		return err
91	}
92	if err = addRetryMiddlewares(stack, options); err != nil {
93		return err
94	}
95	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
102		return err
103	}
104	if err = addClientUserAgent(stack); err != nil {
105		return err
106	}
107	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
108		return err
109	}
110	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
111		return err
112	}
113	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateApp(options.Region), middleware.Before); err != nil {
114		return err
115	}
116	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addResponseErrorMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addRequestResponseLogging(stack, options); err != nil {
123		return err
124	}
125	return nil
126}
127
128func newServiceMetadataMiddleware_opCreateApp(region string) *awsmiddleware.RegisterServiceMetadata {
129	return &awsmiddleware.RegisterServiceMetadata{
130		Region:        region,
131		ServiceID:     ServiceID,
132		SigningName:   "sms",
133		OperationName: "CreateApp",
134	}
135}
136