1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package mwaa 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/mwaa/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Get details of an existing environment. 16func (c *Client) GetEnvironment(ctx context.Context, params *GetEnvironmentInput, optFns ...func(*Options)) (*GetEnvironmentOutput, error) { 17 if params == nil { 18 params = &GetEnvironmentInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "GetEnvironment", params, optFns, addOperationGetEnvironmentMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*GetEnvironmentOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type GetEnvironmentInput struct { 32 33 // The name of the environment to retrieve. 34 // 35 // This member is required. 36 Name *string 37} 38 39type GetEnvironmentOutput struct { 40 41 // A JSON blob with environment details. 42 Environment *types.Environment 43 44 // Metadata pertaining to the operation's result. 45 ResultMetadata middleware.Metadata 46} 47 48func addOperationGetEnvironmentMiddlewares(stack *middleware.Stack, options Options) (err error) { 49 err = stack.Serialize.Add(&awsRestjson1_serializeOpGetEnvironment{}, middleware.After) 50 if err != nil { 51 return err 52 } 53 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetEnvironment{}, middleware.After) 54 if err != nil { 55 return err 56 } 57 if err = addSetLoggerMiddleware(stack, options); err != nil { 58 return err 59 } 60 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 61 return err 62 } 63 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 64 return err 65 } 66 if err = addResolveEndpointMiddleware(stack, options); err != nil { 67 return err 68 } 69 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 70 return err 71 } 72 if err = addRetryMiddlewares(stack, options); err != nil { 73 return err 74 } 75 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 76 return err 77 } 78 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 79 return err 80 } 81 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 82 return err 83 } 84 if err = addClientUserAgent(stack); err != nil { 85 return err 86 } 87 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 88 return err 89 } 90 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 91 return err 92 } 93 if err = addEndpointPrefix_opGetEnvironmentMiddleware(stack); err != nil { 94 return err 95 } 96 if err = addOpGetEnvironmentValidationMiddleware(stack); err != nil { 97 return err 98 } 99 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEnvironment(options.Region), middleware.Before); err != nil { 100 return err 101 } 102 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 103 return err 104 } 105 if err = addResponseErrorMiddleware(stack); err != nil { 106 return err 107 } 108 if err = addRequestResponseLogging(stack, options); err != nil { 109 return err 110 } 111 return nil 112} 113 114type endpointPrefix_opGetEnvironmentMiddleware struct { 115} 116 117func (*endpointPrefix_opGetEnvironmentMiddleware) ID() string { 118 return "EndpointHostPrefix" 119} 120 121func (m *endpointPrefix_opGetEnvironmentMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 122 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 123) { 124 if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { 125 return next.HandleSerialize(ctx, in) 126 } 127 128 req, ok := in.Request.(*smithyhttp.Request) 129 if !ok { 130 return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) 131 } 132 133 req.URL.Host = "api." + req.URL.Host 134 135 return next.HandleSerialize(ctx, in) 136} 137func addEndpointPrefix_opGetEnvironmentMiddleware(stack *middleware.Stack) error { 138 return stack.Serialize.Insert(&endpointPrefix_opGetEnvironmentMiddleware{}, `OperationSerializer`, middleware.After) 139} 140 141func newServiceMetadataMiddleware_opGetEnvironment(region string) *awsmiddleware.RegisterServiceMetadata { 142 return &awsmiddleware.RegisterServiceMetadata{ 143 Region: region, 144 ServiceID: ServiceID, 145 SigningName: "airflow", 146 OperationName: "GetEnvironment", 147 } 148} 149