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, c.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	noSmithyDocumentSerde
48}
49
50type GetEnvironmentOutput struct {
51
52	// The application ID.
53	ApplicationId *string
54
55	// The description of the environment.
56	Description *string
57
58	// The environment ID.
59	Id *string
60
61	// Amazon CloudWatch alarms monitored during the deployment.
62	Monitors []types.Monitor
63
64	// The name of the environment.
65	Name *string
66
67	// The state of the environment. An environment can be in one of the following
68	// states: READY_FOR_DEPLOYMENT, DEPLOYING, ROLLING_BACK, or ROLLED_BACK
69	State types.EnvironmentState
70
71	// Metadata pertaining to the operation's result.
72	ResultMetadata middleware.Metadata
73
74	noSmithyDocumentSerde
75}
76
77func (c *Client) addOperationGetEnvironmentMiddlewares(stack *middleware.Stack, options Options) (err error) {
78	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetEnvironment{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetEnvironment{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	if err = addSetLoggerMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
90		return err
91	}
92	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
93		return err
94	}
95	if err = addResolveEndpointMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
99		return err
100	}
101	if err = addRetryMiddlewares(stack, options); err != nil {
102		return err
103	}
104	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
111		return err
112	}
113	if err = addClientUserAgent(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addOpGetEnvironmentValidationMiddleware(stack); err != nil {
123		return err
124	}
125	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEnvironment(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
140func newServiceMetadataMiddleware_opGetEnvironment(region string) *awsmiddleware.RegisterServiceMetadata {
141	return &awsmiddleware.RegisterServiceMetadata{
142		Region:        region,
143		ServiceID:     ServiceID,
144		SigningName:   "appconfig",
145		OperationName: "GetEnvironment",
146	}
147}
148