Skip to content

Commit 2541cf4

Browse files
AWS CodeBuild now supports PullRequestBuildPolicy in webhook object.
1 parent 8a00e3f commit 2541cf4

File tree

7 files changed

+122
-8
lines changed

7 files changed

+122
-8
lines changed

generator/ServiceModels/codebuild/codebuild-2016-10-06.api.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3378,7 +3378,8 @@
33783378
"lastModifiedSecret":{"shape":"Timestamp"},
33793379
"scopeConfiguration":{"shape":"ScopeConfiguration"},
33803380
"status":{"shape":"WebhookStatus"},
3381-
"statusMessage":{"shape":"String"}
3381+
"statusMessage":{"shape":"String"},
3382+
"pullRequestBuildPolicy":{"shape":"PullRequestBuildPolicy"}
33823383
}
33833384
},
33843385
"WebhookBuildType":{

generator/ServiceModels/codebuild/codebuild-2016-10-06.docs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,10 +1512,11 @@
15121512
}
15131513
},
15141514
"PullRequestBuildPolicy": {
1515-
"base": "<p>Configuration policy that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
1515+
"base": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
15161516
"refs": {
15171517
"CreateWebhookInput$pullRequestBuildPolicy": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
1518-
"UpdateWebhookInput$pullRequestBuildPolicy": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
1518+
"UpdateWebhookInput$pullRequestBuildPolicy": "<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>",
1519+
"Webhook$pullRequestBuildPolicy": null
15191520
}
15201521
},
15211522
"PutResourcePolicyInput": {

generator/ServiceModels/codebuild/codebuild-2016-10-06.normal.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4060,7 +4060,7 @@
40604060
"documentation":"<p>List of repository roles that have approval privileges for pull request builds when comment approval is required. Only users with these roles can provide valid comment approvals. If a pull request contributor is one of these roles, their pull request builds will trigger automatically. This field is only applicable when <code>requiresCommentApproval</code> is not <i>DISABLED</i>.</p>"
40614061
}
40624062
},
4063-
"documentation":"<p>Configuration policy that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
4063+
"documentation":"<p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>"
40644064
},
40654065
"PutResourcePolicyInput":{
40664066
"type":"structure",
@@ -5708,7 +5708,8 @@
57085708
"statusMessage":{
57095709
"shape":"String",
57105710
"documentation":"<p>A message associated with the status of a webhook.</p>"
5711-
}
5711+
},
5712+
"pullRequestBuildPolicy":{"shape":"PullRequestBuildPolicy"}
57125713
},
57135714
"documentation":"<p>Information about a webhook that connects repository events to a build project in CodeBuild.</p>"
57145715
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
/*
17+
* Do not modify this file. This file is generated from the codebuild-2016-10-06.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Globalization;
22+
using System.IO;
23+
using System.Net;
24+
using System.Text;
25+
using System.Xml.Serialization;
26+
27+
using Amazon.CodeBuild.Model;
28+
using Amazon.Runtime;
29+
using Amazon.Runtime.Internal;
30+
using Amazon.Runtime.Internal.Transform;
31+
using Amazon.Runtime.Internal.Util;
32+
using System.Text.Json;
33+
#pragma warning disable CS0612,CS0618
34+
namespace Amazon.CodeBuild.Model.Internal.MarshallTransformations
35+
{
36+
/// <summary>
37+
/// Response Unmarshaller for PullRequestBuildPolicy Object
38+
/// </summary>
39+
public class PullRequestBuildPolicyUnmarshaller : IJsonUnmarshaller<PullRequestBuildPolicy, JsonUnmarshallerContext>
40+
{
41+
/// <summary>
42+
/// Unmarshaller the response from the service to the response class.
43+
/// </summary>
44+
/// <param name="context"></param>
45+
/// <param name="reader"></param>
46+
/// <returns>The unmarshalled object</returns>
47+
public PullRequestBuildPolicy Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
48+
{
49+
PullRequestBuildPolicy unmarshalledObject = new PullRequestBuildPolicy();
50+
if (context.IsEmptyResponse)
51+
return null;
52+
context.Read(ref reader);
53+
if (context.CurrentTokenType == JsonTokenType.Null)
54+
return null;
55+
56+
int targetDepth = context.CurrentDepth;
57+
while (context.ReadAtDepth(targetDepth, ref reader))
58+
{
59+
if (context.TestExpression("approverRoles", targetDepth))
60+
{
61+
var unmarshaller = new JsonListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
62+
unmarshalledObject.ApproverRoles = unmarshaller.Unmarshall(context, ref reader);
63+
continue;
64+
}
65+
if (context.TestExpression("requiresCommentApproval", targetDepth))
66+
{
67+
var unmarshaller = StringUnmarshaller.Instance;
68+
unmarshalledObject.RequiresCommentApproval = unmarshaller.Unmarshall(context, ref reader);
69+
continue;
70+
}
71+
}
72+
return unmarshalledObject;
73+
}
74+
75+
76+
private static PullRequestBuildPolicyUnmarshaller _instance = new PullRequestBuildPolicyUnmarshaller();
77+
78+
/// <summary>
79+
/// Gets the singleton.
80+
/// </summary>
81+
public static PullRequestBuildPolicyUnmarshaller Instance
82+
{
83+
get
84+
{
85+
return _instance;
86+
}
87+
}
88+
}
89+
}

sdk/src/Services/CodeBuild/Generated/Model/Internal/MarshallTransformations/WebhookUnmarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ public Webhook Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8Json
9292
unmarshalledObject.PayloadUrl = unmarshaller.Unmarshall(context, ref reader);
9393
continue;
9494
}
95+
if (context.TestExpression("pullRequestBuildPolicy", targetDepth))
96+
{
97+
var unmarshaller = PullRequestBuildPolicyUnmarshaller.Instance;
98+
unmarshalledObject.PullRequestBuildPolicy = unmarshaller.Unmarshall(context, ref reader);
99+
continue;
100+
}
95101
if (context.TestExpression("scopeConfiguration", targetDepth))
96102
{
97103
var unmarshaller = ScopeConfigurationUnmarshaller.Instance;

sdk/src/Services/CodeBuild/Generated/Model/PullRequestBuildPolicy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
namespace Amazon.CodeBuild.Model
3131
{
3232
/// <summary>
33-
/// Configuration policy that defines comment-based approval requirements for triggering
34-
/// builds on pull requests. This policy helps control when automated builds are executed
35-
/// based on contributor permissions and approval workflows.
33+
/// A PullRequestBuildPolicy object that defines comment-based approval requirements for
34+
/// triggering builds on pull requests. This policy helps control when automated builds
35+
/// are executed based on contributor permissions and approval workflows.
3636
/// </summary>
3737
public partial class PullRequestBuildPolicy
3838
{

sdk/src/Services/CodeBuild/Generated/Model/Webhook.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public partial class Webhook
4141
private DateTime? _lastModifiedSecret;
4242
private bool? _manualCreation;
4343
private string _payloadUrl;
44+
private PullRequestBuildPolicy _pullRequestBuildPolicy;
4445
private ScopeConfiguration _scopeConfiguration;
4546
private string _secret;
4647
private WebhookStatus _status;
@@ -193,6 +194,21 @@ internal bool IsSetPayloadUrl()
193194
return this._payloadUrl != null;
194195
}
195196

197+
/// <summary>
198+
/// Gets and sets the property PullRequestBuildPolicy.
199+
/// </summary>
200+
public PullRequestBuildPolicy PullRequestBuildPolicy
201+
{
202+
get { return this._pullRequestBuildPolicy; }
203+
set { this._pullRequestBuildPolicy = value; }
204+
}
205+
206+
// Check to see if PullRequestBuildPolicy property is set
207+
internal bool IsSetPullRequestBuildPolicy()
208+
{
209+
return this._pullRequestBuildPolicy != null;
210+
}
211+
196212
/// <summary>
197213
/// Gets and sets the property ScopeConfiguration.
198214
/// <para>

0 commit comments

Comments
 (0)