1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package codebuild
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/codebuild/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Changes the settings of a build project.
15func (c *Client) UpdateProject(ctx context.Context, params *UpdateProjectInput, optFns ...func(*Options)) (*UpdateProjectOutput, error) {
16	if params == nil {
17		params = &UpdateProjectInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "UpdateProject", params, optFns, addOperationUpdateProjectMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*UpdateProjectOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type UpdateProjectInput struct {
31
32	// The name of the build project. You cannot change a build project's name.
33	//
34	// This member is required.
35	Name *string
36
37	// Information to be changed about the build output artifacts for the build
38	// project.
39	Artifacts *types.ProjectArtifacts
40
41	// Set this to true to generate a publicly accessible URL for your project's build
42	// badge.
43	BadgeEnabled *bool
44
45	// Contains configuration information about a batch build project.
46	BuildBatchConfig *types.ProjectBuildBatchConfig
47
48	// Stores recently used information so that it can be quickly accessed at a later
49	// time.
50	Cache *types.ProjectCache
51
52	// A new or replacement description of the build project.
53	Description *string
54
55	// The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used
56	// for encrypting the build output artifacts. You can use a cross-account KMS key
57	// to encrypt the build output artifacts if your service role has permission to
58	// that key. You can specify either the Amazon Resource Name (ARN) of the CMK or,
59	// if available, the CMK's alias (using the format alias/).
60	EncryptionKey *string
61
62	// Information to be changed about the build environment for the build project.
63	Environment *types.ProjectEnvironment
64
65	// An array of ProjectFileSystemLocation objects for a CodeBuild build project. A
66	// ProjectFileSystemLocation object specifies the identifier, location,
67	// mountOptions, mountPoint, and type of a file system created using Amazon Elastic
68	// File System.
69	FileSystemLocations []types.ProjectFileSystemLocation
70
71	// Information about logs for the build project. A project can create logs in
72	// Amazon CloudWatch Logs, logs in an S3 bucket, or both.
73	LogsConfig *types.LogsConfig
74
75	// The number of minutes a build is allowed to be queued before it times out.
76	QueuedTimeoutInMinutes *int32
77
78	// An array of ProjectSource objects.
79	SecondaryArtifacts []types.ProjectArtifacts
80
81	// An array of ProjectSourceVersion objects. If secondarySourceVersions is
82	// specified at the build level, then they take over these secondarySourceVersions
83	// (at the project level).
84	SecondarySourceVersions []types.ProjectSourceVersion
85
86	// An array of ProjectSource objects.
87	SecondarySources []types.ProjectSource
88
89	// The replacement ARN of the AWS Identity and Access Management (IAM) role that
90	// enables AWS CodeBuild to interact with dependent AWS services on behalf of the
91	// AWS account.
92	ServiceRole *string
93
94	// Information to be changed about the build input source code for the build
95	// project.
96	Source *types.ProjectSource
97
98	// A version of the build input to be built for this project. If not specified, the
99	// latest version is used. If specified, it must be one of:
100	//
101	// * For AWS CodeCommit:
102	// the commit ID, branch, or Git tag to use.
103	//
104	// * For GitHub: the commit ID, pull
105	// request ID, branch name, or tag name that corresponds to the version of the
106	// source code you want to build. If a pull request ID is specified, it must use
107	// the format pr/pull-request-ID (for example pr/25). If a branch name is
108	// specified, the branch's HEAD commit ID is used. If not specified, the default
109	// branch's HEAD commit ID is used.
110	//
111	// * For Bitbucket: the commit ID, branch name,
112	// or tag name that corresponds to the version of the source code you want to
113	// build. If a branch name is specified, the branch's HEAD commit ID is used. If
114	// not specified, the default branch's HEAD commit ID is used.
115	//
116	// * For Amazon Simple
117	// Storage Service (Amazon S3): the version ID of the object that represents the
118	// build input ZIP file to use.
119	//
120	// If sourceVersion is specified at the build level,
121	// then that version takes precedence over this sourceVersion (at the project
122	// level). For more information, see Source Version Sample with CodeBuild
123	// (https://docs.aws.amazon.com/codebuild/latest/userguide/sample-source-version.html)
124	// in the AWS CodeBuild User Guide.
125	SourceVersion *string
126
127	// An updated list of tag key and value pairs associated with this build project.
128	// These tags are available for use by AWS services that support AWS CodeBuild
129	// build project tags.
130	Tags []types.Tag
131
132	// The replacement value in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to
133	// wait before timing out any related build that did not get marked as completed.
134	TimeoutInMinutes *int32
135
136	// VpcConfig enables AWS CodeBuild to access resources in an Amazon VPC.
137	VpcConfig *types.VpcConfig
138}
139
140type UpdateProjectOutput struct {
141
142	// Information about the build project that was changed.
143	Project *types.Project
144
145	// Metadata pertaining to the operation's result.
146	ResultMetadata middleware.Metadata
147}
148
149func addOperationUpdateProjectMiddlewares(stack *middleware.Stack, options Options) (err error) {
150	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateProject{}, middleware.After)
151	if err != nil {
152		return err
153	}
154	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateProject{}, middleware.After)
155	if err != nil {
156		return err
157	}
158	if err = addSetLoggerMiddleware(stack, options); err != nil {
159		return err
160	}
161	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
162		return err
163	}
164	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
165		return err
166	}
167	if err = addResolveEndpointMiddleware(stack, options); err != nil {
168		return err
169	}
170	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
171		return err
172	}
173	if err = addRetryMiddlewares(stack, options); err != nil {
174		return err
175	}
176	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
177		return err
178	}
179	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
180		return err
181	}
182	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
183		return err
184	}
185	if err = addClientUserAgent(stack); err != nil {
186		return err
187	}
188	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
189		return err
190	}
191	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
192		return err
193	}
194	if err = addOpUpdateProjectValidationMiddleware(stack); err != nil {
195		return err
196	}
197	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateProject(options.Region), middleware.Before); err != nil {
198		return err
199	}
200	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
201		return err
202	}
203	if err = addResponseErrorMiddleware(stack); err != nil {
204		return err
205	}
206	if err = addRequestResponseLogging(stack, options); err != nil {
207		return err
208	}
209	return nil
210}
211
212func newServiceMetadataMiddleware_opUpdateProject(region string) *awsmiddleware.RegisterServiceMetadata {
213	return &awsmiddleware.RegisterServiceMetadata{
214		Region:        region,
215		ServiceID:     ServiceID,
216		SigningName:   "codebuild",
217		OperationName: "UpdateProject",
218	}
219}
220