1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package amplifybackend
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/amplifybackend/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new backend authentication resource.
15func (c *Client) CreateBackendAuth(ctx context.Context, params *CreateBackendAuthInput, optFns ...func(*Options)) (*CreateBackendAuthOutput, error) {
16	if params == nil {
17		params = &CreateBackendAuthInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateBackendAuth", params, optFns, c.addOperationCreateBackendAuthMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateBackendAuthOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// The request body for CreateBackendAuth.
31type CreateBackendAuthInput struct {
32
33	// The app ID.
34	//
35	// This member is required.
36	AppId *string
37
38	// The name of the backend environment.
39	//
40	// This member is required.
41	BackendEnvironmentName *string
42
43	// The resource configuration for this request object.
44	//
45	// This member is required.
46	ResourceConfig *types.CreateBackendAuthResourceConfig
47
48	// The name of this resource.
49	//
50	// This member is required.
51	ResourceName *string
52
53	noSmithyDocumentSerde
54}
55
56type CreateBackendAuthOutput struct {
57
58	// The app ID.
59	AppId *string
60
61	// The name of the backend environment.
62	BackendEnvironmentName *string
63
64	// If the request fails, this error is returned.
65	Error *string
66
67	// The ID for the job.
68	JobId *string
69
70	// The name of the operation.
71	Operation *string
72
73	// The current status of the request.
74	Status *string
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78
79	noSmithyDocumentSerde
80}
81
82func (c *Client) addOperationCreateBackendAuthMiddlewares(stack *middleware.Stack, options Options) (err error) {
83	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateBackendAuth{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateBackendAuth{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	if err = addSetLoggerMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
95		return err
96	}
97	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
98		return err
99	}
100	if err = addResolveEndpointMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
104		return err
105	}
106	if err = addRetryMiddlewares(stack, options); err != nil {
107		return err
108	}
109	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
116		return err
117	}
118	if err = addClientUserAgent(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addOpCreateBackendAuthValidationMiddleware(stack); err != nil {
128		return err
129	}
130	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBackendAuth(options.Region), middleware.Before); err != nil {
131		return err
132	}
133	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addResponseErrorMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addRequestResponseLogging(stack, options); err != nil {
140		return err
141	}
142	return nil
143}
144
145func newServiceMetadataMiddleware_opCreateBackendAuth(region string) *awsmiddleware.RegisterServiceMetadata {
146	return &awsmiddleware.RegisterServiceMetadata{
147		Region:        region,
148		ServiceID:     ServiceID,
149		SigningName:   "amplifybackend",
150		OperationName: "CreateBackendAuth",
151	}
152}
153