1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package appconfig 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/appconfig/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Retrieve information about an environment. An environment is a logical 15// deployment group of AppConfig applications, such as applications in a Production 16// environment or in an EU_Region environment. Each configuration deployment 17// targets an environment. You can enable one or more Amazon CloudWatch alarms for 18// an environment. If an alarm is triggered during a deployment, AppConfig roles 19// back the configuration. 20func (c *Client) GetEnvironment(ctx context.Context, params *GetEnvironmentInput, optFns ...func(*Options)) (*GetEnvironmentOutput, error) { 21 if params == nil { 22 params = &GetEnvironmentInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "GetEnvironment", params, optFns, addOperationGetEnvironmentMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*GetEnvironmentOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35type GetEnvironmentInput struct { 36 37 // The ID of the application that includes the environment you want to get. 38 // 39 // This member is required. 40 ApplicationId *string 41 42 // The ID of the environment you wnat to get. 43 // 44 // This member is required. 45 EnvironmentId *string 46} 47 48type GetEnvironmentOutput struct { 49 50 // The application ID. 51 ApplicationId *string 52 53 // The description of the environment. 54 Description *string 55 56 // The environment ID. 57 Id *string 58 59 // Amazon CloudWatch alarms monitored during the deployment. 60 Monitors []types.Monitor 61 62 // The name of the environment. 63 Name *string 64 65 // The state of the environment. An environment can be in one of the following 66 // states: READY_FOR_DEPLOYMENT, DEPLOYING, ROLLING_BACK, or ROLLED_BACK 67 State types.EnvironmentState 68 69 // Metadata pertaining to the operation's result. 70 ResultMetadata middleware.Metadata 71} 72 73func addOperationGetEnvironmentMiddlewares(stack *middleware.Stack, options Options) (err error) { 74 err = stack.Serialize.Add(&awsRestjson1_serializeOpGetEnvironment{}, middleware.After) 75 if err != nil { 76 return err 77 } 78 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetEnvironment{}, middleware.After) 79 if err != nil { 80 return err 81 } 82 if err = addSetLoggerMiddleware(stack, options); err != nil { 83 return err 84 } 85 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 86 return err 87 } 88 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 89 return err 90 } 91 if err = addResolveEndpointMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 95 return err 96 } 97 if err = addRetryMiddlewares(stack, options); err != nil { 98 return err 99 } 100 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 101 return err 102 } 103 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 104 return err 105 } 106 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 107 return err 108 } 109 if err = addClientUserAgent(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 113 return err 114 } 115 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 116 return err 117 } 118 if err = addOpGetEnvironmentValidationMiddleware(stack); err != nil { 119 return err 120 } 121 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEnvironment(options.Region), middleware.Before); err != nil { 122 return err 123 } 124 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addResponseErrorMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addRequestResponseLogging(stack, options); err != nil { 131 return err 132 } 133 return nil 134} 135 136func newServiceMetadataMiddleware_opGetEnvironment(region string) *awsmiddleware.RegisterServiceMetadata { 137 return &awsmiddleware.RegisterServiceMetadata{ 138 Region: region, 139 ServiceID: ServiceID, 140 SigningName: "appconfig", 141 OperationName: "GetEnvironment", 142 } 143} 144