1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package alexaforbusiness
4
5import (
6	"context"
7	"fmt"
8	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
10	"github.com/aws/aws-sdk-go-v2/service/alexaforbusiness/types"
11	"github.com/aws/smithy-go/middleware"
12	smithyhttp "github.com/aws/smithy-go/transport/http"
13)
14
15// Adds a new conference provider under the user's AWS account.
16func (c *Client) CreateConferenceProvider(ctx context.Context, params *CreateConferenceProviderInput, optFns ...func(*Options)) (*CreateConferenceProviderOutput, error) {
17	if params == nil {
18		params = &CreateConferenceProviderInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateConferenceProvider", params, optFns, c.addOperationCreateConferenceProviderMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateConferenceProviderOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type CreateConferenceProviderInput struct {
32
33	// The name of the conference provider.
34	//
35	// This member is required.
36	ConferenceProviderName *string
37
38	// Represents a type within a list of predefined types.
39	//
40	// This member is required.
41	ConferenceProviderType types.ConferenceProviderType
42
43	// The meeting settings for the conference provider.
44	//
45	// This member is required.
46	MeetingSetting *types.MeetingSetting
47
48	// The request token of the client.
49	ClientRequestToken *string
50
51	// The IP endpoint and protocol for calling.
52	IPDialIn *types.IPDialIn
53
54	// The information for PSTN conferencing.
55	PSTNDialIn *types.PSTNDialIn
56
57	// The tags to be added to the specified resource. Do not provide system tags.
58	Tags []types.Tag
59
60	noSmithyDocumentSerde
61}
62
63type CreateConferenceProviderOutput struct {
64
65	// The ARN of the newly-created conference provider.
66	ConferenceProviderArn *string
67
68	// Metadata pertaining to the operation's result.
69	ResultMetadata middleware.Metadata
70
71	noSmithyDocumentSerde
72}
73
74func (c *Client) addOperationCreateConferenceProviderMiddlewares(stack *middleware.Stack, options Options) (err error) {
75	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateConferenceProvider{}, middleware.After)
76	if err != nil {
77		return err
78	}
79	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateConferenceProvider{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	if err = addSetLoggerMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
87		return err
88	}
89	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
90		return err
91	}
92	if err = addResolveEndpointMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
96		return err
97	}
98	if err = addRetryMiddlewares(stack, options); err != nil {
99		return err
100	}
101	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
102		return err
103	}
104	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
108		return err
109	}
110	if err = addClientUserAgent(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addIdempotencyToken_opCreateConferenceProviderMiddleware(stack, options); err != nil {
120		return err
121	}
122	if err = addOpCreateConferenceProviderValidationMiddleware(stack); err != nil {
123		return err
124	}
125	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateConferenceProvider(options.Region), middleware.Before); err != nil {
126		return err
127	}
128	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResponseErrorMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addRequestResponseLogging(stack, options); err != nil {
135		return err
136	}
137	return nil
138}
139
140type idempotencyToken_initializeOpCreateConferenceProvider struct {
141	tokenProvider IdempotencyTokenProvider
142}
143
144func (*idempotencyToken_initializeOpCreateConferenceProvider) ID() string {
145	return "OperationIdempotencyTokenAutoFill"
146}
147
148func (m *idempotencyToken_initializeOpCreateConferenceProvider) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
149	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
150) {
151	if m.tokenProvider == nil {
152		return next.HandleInitialize(ctx, in)
153	}
154
155	input, ok := in.Parameters.(*CreateConferenceProviderInput)
156	if !ok {
157		return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateConferenceProviderInput ")
158	}
159
160	if input.ClientRequestToken == nil {
161		t, err := m.tokenProvider.GetIdempotencyToken()
162		if err != nil {
163			return out, metadata, err
164		}
165		input.ClientRequestToken = &t
166	}
167	return next.HandleInitialize(ctx, in)
168}
169func addIdempotencyToken_opCreateConferenceProviderMiddleware(stack *middleware.Stack, cfg Options) error {
170	return stack.Initialize.Add(&idempotencyToken_initializeOpCreateConferenceProvider{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
171}
172
173func newServiceMetadataMiddleware_opCreateConferenceProvider(region string) *awsmiddleware.RegisterServiceMetadata {
174	return &awsmiddleware.RegisterServiceMetadata{
175		Region:        region,
176		ServiceID:     ServiceID,
177		SigningName:   "a4b",
178		OperationName: "CreateConferenceProvider",
179	}
180}
181