// Code generated by smithy-go-codegen DO NOT EDIT. package mediapackagev2 import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/mediapackagev2/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Create a channel to start receiving content streams. The channel represents the // input to MediaPackage for incoming live content from an encoder such as AWS // Elemental MediaLive. The channel receives content, and after packaging it, // outputs it through an origin endpoint to downstream devices (such as video // players or CDNs) that request the content. You can create only one channel with // each request. We recommend that you spread out channels between channel groups, // such as putting redundant channels in the same AWS Region in different channel // groups. func (c *Client) CreateChannel(ctx context.Context, params *CreateChannelInput, optFns ...func(*Options)) (*CreateChannelOutput, error) { if params == nil { params = &CreateChannelInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateChannel", params, optFns, c.addOperationCreateChannelMiddlewares) if err != nil { return nil, err } out := result.(*CreateChannelOutput) out.ResultMetadata = metadata return out, nil } type CreateChannelInput struct { // The name that describes the channel group. The name is the primary identifier // for the channel group, and must be unique for your account in the AWS Region. // // This member is required. ChannelGroupName *string // The name that describes the channel. The name is the primary identifier for the // channel, and must be unique for your account in the AWS Region and channel // group. You can't change the name after you create the channel. // // This member is required. ChannelName *string // A unique, case-sensitive token that you provide to ensure the idempotency of // the request. ClientToken *string // Enter any descriptive text that helps you to identify the channel. Description *string // A comma-separated list of tag key:value pairs that you define. For example: // "Key1": "Value1", // "Key2": "Value2" Tags map[string]string noSmithyDocumentSerde } type CreateChannelOutput struct { // The Amazon Resource Name (ARN) associated with the resource. // // This member is required. Arn *string // The name that describes the channel group. The name is the primary identifier // for the channel group, and must be unique for your account in the AWS Region. // // This member is required. ChannelGroupName *string // The name that describes the channel. The name is the primary identifier for the // channel, and must be unique for your account in the AWS Region and channel // group. // // This member is required. ChannelName *string // The date and time the channel was created. // // This member is required. CreatedAt *time.Time // The date and time the channel was modified. // // This member is required. ModifiedAt *time.Time // The description for your channel. Description *string // The list of ingest endpoints. IngestEndpoints []types.IngestEndpoint // The comma-separated list of tag key:value pairs assigned to the channel. Tags map[string]string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateChannelMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateChannel{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateChannel{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack, options); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addIdempotencyToken_opCreateChannelMiddleware(stack, options); err != nil { return err } if err = addOpCreateChannelValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateChannel(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type idempotencyToken_initializeOpCreateChannel struct { tokenProvider IdempotencyTokenProvider } func (*idempotencyToken_initializeOpCreateChannel) ID() string { return "OperationIdempotencyTokenAutoFill" } func (m *idempotencyToken_initializeOpCreateChannel) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { if m.tokenProvider == nil { return next.HandleInitialize(ctx, in) } input, ok := in.Parameters.(*CreateChannelInput) if !ok { return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateChannelInput ") } if input.ClientToken == nil { t, err := m.tokenProvider.GetIdempotencyToken() if err != nil { return out, metadata, err } input.ClientToken = &t } return next.HandleInitialize(ctx, in) } func addIdempotencyToken_opCreateChannelMiddleware(stack *middleware.Stack, cfg Options) error { return stack.Initialize.Add(&idempotencyToken_initializeOpCreateChannel{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) } func newServiceMetadataMiddleware_opCreateChannel(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "mediapackagev2", OperationName: "CreateChannel", } }