Skip to content

Commit daea952

Browse files
AWS CodeBuild now supports PullRequestBuildPolicy in webhook object.
1 parent ff773d8 commit daea952

File tree

7 files changed

+132
-8
lines changed

7 files changed

+132
-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,99 @@
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 ThirdParty.Json.LitJson;
33+
34+
#pragma warning disable CS0612,CS0618
35+
namespace Amazon.CodeBuild.Model.Internal.MarshallTransformations
36+
{
37+
/// <summary>
38+
/// Response Unmarshaller for PullRequestBuildPolicy Object
39+
/// </summary>
40+
public class PullRequestBuildPolicyUnmarshaller : IUnmarshaller<PullRequestBuildPolicy, XmlUnmarshallerContext>, IUnmarshaller<PullRequestBuildPolicy, JsonUnmarshallerContext>
41+
{
42+
/// <summary>
43+
/// Unmarshaller the response from the service to the response class.
44+
/// </summary>
45+
/// <param name="context"></param>
46+
/// <returns></returns>
47+
PullRequestBuildPolicy IUnmarshaller<PullRequestBuildPolicy, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
48+
{
49+
throw new NotImplementedException();
50+
}
51+
52+
/// <summary>
53+
/// Unmarshaller the response from the service to the response class.
54+
/// </summary>
55+
/// <param name="context"></param>
56+
/// <returns>The unmarshalled object</returns>
57+
public PullRequestBuildPolicy Unmarshall(JsonUnmarshallerContext context)
58+
{
59+
PullRequestBuildPolicy unmarshalledObject = new PullRequestBuildPolicy();
60+
if (context.IsEmptyResponse)
61+
return null;
62+
context.Read();
63+
if (context.CurrentTokenType == JsonToken.Null)
64+
return null;
65+
66+
int targetDepth = context.CurrentDepth;
67+
while (context.ReadAtDepth(targetDepth))
68+
{
69+
if (context.TestExpression("approverRoles", targetDepth))
70+
{
71+
var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance);
72+
unmarshalledObject.ApproverRoles = unmarshaller.Unmarshall(context);
73+
continue;
74+
}
75+
if (context.TestExpression("requiresCommentApproval", targetDepth))
76+
{
77+
var unmarshaller = StringUnmarshaller.Instance;
78+
unmarshalledObject.RequiresCommentApproval = unmarshaller.Unmarshall(context);
79+
continue;
80+
}
81+
}
82+
return unmarshalledObject;
83+
}
84+
85+
86+
private static PullRequestBuildPolicyUnmarshaller _instance = new PullRequestBuildPolicyUnmarshaller();
87+
88+
/// <summary>
89+
/// Gets the singleton.
90+
/// </summary>
91+
public static PullRequestBuildPolicyUnmarshaller Instance
92+
{
93+
get
94+
{
95+
return _instance;
96+
}
97+
}
98+
}
99+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ public Webhook Unmarshall(JsonUnmarshallerContext context)
102102
unmarshalledObject.PayloadUrl = unmarshaller.Unmarshall(context);
103103
continue;
104104
}
105+
if (context.TestExpression("pullRequestBuildPolicy", targetDepth))
106+
{
107+
var unmarshaller = PullRequestBuildPolicyUnmarshaller.Instance;
108+
unmarshalledObject.PullRequestBuildPolicy = unmarshaller.Unmarshall(context);
109+
continue;
110+
}
105111
if (context.TestExpression("scopeConfiguration", targetDepth))
106112
{
107113
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;
@@ -188,6 +189,21 @@ internal bool IsSetPayloadUrl()
188189
return this._payloadUrl != null;
189190
}
190191

192+
/// <summary>
193+
/// Gets and sets the property PullRequestBuildPolicy.
194+
/// </summary>
195+
public PullRequestBuildPolicy PullRequestBuildPolicy
196+
{
197+
get { return this._pullRequestBuildPolicy; }
198+
set { this._pullRequestBuildPolicy = value; }
199+
}
200+
201+
// Check to see if PullRequestBuildPolicy property is set
202+
internal bool IsSetPullRequestBuildPolicy()
203+
{
204+
return this._pullRequestBuildPolicy != null;
205+
}
206+
191207
/// <summary>
192208
/// Gets and sets the property ScopeConfiguration.
193209
/// <para>

0 commit comments

Comments
 (0)