1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package apprunner
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/apprunner/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Update an AWS App Runner service. You can update the source configuration and
15// instance configuration of the service. You can also update the ARN of the auto
16// scaling configuration resource that's associated with the service. However, you
17// can't change the name or the encryption configuration of the service. These can
18// be set only when you create the service. To update the tags applied to your
19// service, use the separate actions TagResource and UntagResource. This is an
20// asynchronous operation. On a successful call, you can use the returned
21// OperationId and the ListOperations call to track the operation's progress.
22func (c *Client) UpdateService(ctx context.Context, params *UpdateServiceInput, optFns ...func(*Options)) (*UpdateServiceOutput, error) {
23	if params == nil {
24		params = &UpdateServiceInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "UpdateService", params, optFns, c.addOperationUpdateServiceMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*UpdateServiceOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type UpdateServiceInput struct {
38
39	// The Amazon Resource Name (ARN) of the App Runner service that you want to
40	// update.
41	//
42	// This member is required.
43	ServiceArn *string
44
45	// The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration
46	// resource that you want to associate with your service.
47	AutoScalingConfigurationArn *string
48
49	// The settings for the health check that AWS App Runner performs to monitor the
50	// health of your service.
51	HealthCheckConfiguration *types.HealthCheckConfiguration
52
53	// The runtime configuration to apply to instances (scaling units) of the App
54	// Runner service.
55	InstanceConfiguration *types.InstanceConfiguration
56
57	// The source configuration to apply to the App Runner service. You can change the
58	// configuration of the code or image repository that the service uses. However,
59	// you can't switch from code to image or the other way around. This means that you
60	// must provide the same structure member of SourceConfiguration that you
61	// originally included when you created the service. Specifically, you can include
62	// either CodeRepository or ImageRepository. To update the source configuration,
63	// set the values to members of the structure that you include.
64	SourceConfiguration *types.SourceConfiguration
65
66	noSmithyDocumentSerde
67}
68
69type UpdateServiceOutput struct {
70
71	// The unique ID of the asynchronous operation that this request started. You can
72	// use it combined with the ListOperations call to track the operation's progress.
73	//
74	// This member is required.
75	OperationId *string
76
77	// A description of the App Runner service updated by this request. All
78	// configuration values in the returned Service structure reflect configuration
79	// changes that are being applied by this request.
80	//
81	// This member is required.
82	Service *types.Service
83
84	// Metadata pertaining to the operation's result.
85	ResultMetadata middleware.Metadata
86
87	noSmithyDocumentSerde
88}
89
90func (c *Client) addOperationUpdateServiceMiddlewares(stack *middleware.Stack, options Options) (err error) {
91	err = stack.Serialize.Add(&awsAwsjson10_serializeOpUpdateService{}, middleware.After)
92	if err != nil {
93		return err
94	}
95	err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpUpdateService{}, middleware.After)
96	if err != nil {
97		return err
98	}
99	if err = addSetLoggerMiddleware(stack, options); err != nil {
100		return err
101	}
102	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
103		return err
104	}
105	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
106		return err
107	}
108	if err = addResolveEndpointMiddleware(stack, options); err != nil {
109		return err
110	}
111	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
112		return err
113	}
114	if err = addRetryMiddlewares(stack, options); err != nil {
115		return err
116	}
117	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
118		return err
119	}
120	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
121		return err
122	}
123	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
124		return err
125	}
126	if err = addClientUserAgent(stack); err != nil {
127		return err
128	}
129	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
130		return err
131	}
132	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addOpUpdateServiceValidationMiddleware(stack); err != nil {
136		return err
137	}
138	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateService(options.Region), middleware.Before); err != nil {
139		return err
140	}
141	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
142		return err
143	}
144	if err = addResponseErrorMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addRequestResponseLogging(stack, options); err != nil {
148		return err
149	}
150	return nil
151}
152
153func newServiceMetadataMiddleware_opUpdateService(region string) *awsmiddleware.RegisterServiceMetadata {
154	return &awsmiddleware.RegisterServiceMetadata{
155		Region:        region,
156		ServiceID:     ServiceID,
157		SigningName:   "apprunner",
158		OperationName: "UpdateService",
159	}
160}
161