1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package proton
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/proton/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Create a service template. The administrator creates a service template to
15// define standardized infrastructure and an optional CICD service pipeline.
16// Developers, in turn, select the service template from AWS Proton. If the
17// selected service template includes a service pipeline definition, they provide a
18// link to their source code repository. AWS Proton then deploys and manages the
19// infrastructure defined by the selected service template. For more information,
20// see Service Templates
21// (https://docs.aws.amazon.com/proton/latest/adminguide/managing-svc-templates.html)
22// in the AWS Proton Administrator Guide.
23func (c *Client) CreateServiceTemplate(ctx context.Context, params *CreateServiceTemplateInput, optFns ...func(*Options)) (*CreateServiceTemplateOutput, error) {
24	if params == nil {
25		params = &CreateServiceTemplateInput{}
26	}
27
28	result, metadata, err := c.invokeOperation(ctx, "CreateServiceTemplate", params, optFns, c.addOperationCreateServiceTemplateMiddlewares)
29	if err != nil {
30		return nil, err
31	}
32
33	out := result.(*CreateServiceTemplateOutput)
34	out.ResultMetadata = metadata
35	return out, nil
36}
37
38type CreateServiceTemplateInput struct {
39
40	// The name of the service template.
41	//
42	// This member is required.
43	Name *string
44
45	// A description of the service template.
46	Description *string
47
48	// The name of the service template as displayed in the developer interface.
49	DisplayName *string
50
51	// A customer provided encryption key that's used to encrypt data.
52	EncryptionKey *string
53
54	// AWS Proton includes a service pipeline for your service by default. When
55	// included, this parameter indicates that an AWS Proton service pipeline won't be
56	// included for your service. Once specified, this parameter can't be changed. For
57	// more information, see Service template bundles
58	// (https://docs.aws.amazon.com/proton/latest/adminguide/ag-template-bundles.html)
59	// in the AWS Proton Administrator Guide.
60	PipelineProvisioning types.Provisioning
61
62	// Create tags for your service template. For more information, see AWS Proton
63	// resources and tagging in the AWS Proton Administrator Guide
64	// (https://docs.aws.amazon.com/proton/latest/adminguide/resources.html) or AWS
65	// Proton User Guide
66	// (https://docs.aws.amazon.com/proton/latest/userguide/resources.html).
67	Tags []types.Tag
68
69	noSmithyDocumentSerde
70}
71
72type CreateServiceTemplateOutput struct {
73
74	// The service template detail data that's returned by AWS Proton.
75	//
76	// This member is required.
77	ServiceTemplate *types.ServiceTemplate
78
79	// Metadata pertaining to the operation's result.
80	ResultMetadata middleware.Metadata
81
82	noSmithyDocumentSerde
83}
84
85func (c *Client) addOperationCreateServiceTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) {
86	err = stack.Serialize.Add(&awsAwsjson10_serializeOpCreateServiceTemplate{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpCreateServiceTemplate{}, 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 = addOpCreateServiceTemplateValidationMiddleware(stack); err != nil {
131		return err
132	}
133	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateServiceTemplate(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_opCreateServiceTemplate(region string) *awsmiddleware.RegisterServiceMetadata {
149	return &awsmiddleware.RegisterServiceMetadata{
150		Region:        region,
151		ServiceID:     ServiceID,
152		SigningName:   "proton",
153		OperationName: "CreateServiceTemplate",
154	}
155}
156