Skip to content

Commit 8febf30

Browse files
This feature allows AWS Synthetics customers to provide code dependencies using lambda layer while creating a canary
1 parent 3ab9cb3 commit 8febf30

File tree

12 files changed

+439
-2
lines changed

12 files changed

+439
-2
lines changed

generator/ServiceModels/synthetics/synthetics-2017-10-11.api.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,16 @@
461461
"S3Key":{"shape":"String"},
462462
"S3Version":{"shape":"String"},
463463
"ZipFile":{"shape":"Blob"},
464-
"Handler":{"shape":"CodeHandler"}
464+
"Handler":{"shape":"CodeHandler"},
465+
"Dependencies":{"shape":"Dependencies"}
465466
}
466467
},
467468
"CanaryCodeOutput":{
468469
"type":"structure",
469470
"members":{
470471
"SourceLocationArn":{"shape":"String"},
471-
"Handler":{"shape":"String"}
472+
"Handler":{"shape":"String"},
473+
"Dependencies":{"shape":"Dependencies"}
472474
}
473475
},
474476
"CanaryDryRunConfigOutput":{
@@ -727,6 +729,24 @@
727729
"type":"structure",
728730
"members":{}
729731
},
732+
"Dependencies":{
733+
"type":"list",
734+
"member":{"shape":"Dependency"},
735+
"max":1,
736+
"min":0
737+
},
738+
"Dependency":{
739+
"type":"structure",
740+
"required":["Reference"],
741+
"members":{
742+
"Type":{"shape":"DependencyType"},
743+
"Reference":{"shape":"String"}
744+
}
745+
},
746+
"DependencyType":{
747+
"type":"string",
748+
"enum":["LambdaLayer"]
749+
},
730750
"DescribeCanariesLastRunNameFilter":{
731751
"type":"list",
732752
"member":{"shape":"CanaryName"},

generator/ServiceModels/synthetics/synthetics-2017-10-11.docs.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,25 @@
295295
"base": null,
296296
"refs": {}
297297
},
298+
"Dependencies": {
299+
"base": null,
300+
"refs": {
301+
"CanaryCodeInput$Dependencies": "<p>A list of dependencies that should be used for running this canary. Specify the dependencies as a key-value pair, where the key is the type of dependency and the value is the dependency reference.</p>",
302+
"CanaryCodeOutput$Dependencies": "<p>A list of dependencies that are used for running this canary. The dependencies are specified as a key-value pair, where the key is the type of dependency and the value is the dependency reference.</p>"
303+
}
304+
},
305+
"Dependency": {
306+
"base": "<p>A structure that contains information about a dependency for a canary.</p>",
307+
"refs": {
308+
"Dependencies$member": null
309+
}
310+
},
311+
"DependencyType": {
312+
"base": null,
313+
"refs": {
314+
"Dependency$Type": "<p>The type of dependency. Valid value is <code>LambdaLayer</code>.</p>"
315+
}
316+
},
298317
"DescribeCanariesLastRunNameFilter": {
299318
"base": null,
300319
"refs": {
@@ -748,6 +767,7 @@
748767
"CanaryStatus$StateReason": "<p>If the canary creation or update failed, this field provides details on the failure.</p>",
749768
"CreateCanaryRequest$ArtifactS3Location": "<p>The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the Amazon S3 bucket can't include a period (.).</p>",
750769
"CreateCanaryRequest$RuntimeVersion": "<p>Specifies the runtime version to use for the canary. For a list of valid runtime versions and more information about runtime versions, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html\"> Canary Runtime Versions</a>.</p>",
770+
"Dependency$Reference": "<p>The dependency reference. For Lambda layers, this is the ARN of the Lambda layer. For more information about Lambda ARN format, see <a href=\"https://docs.aws.amazon.com/lambda/latest/api/API_Layer.html\">Lambda</a>.</p>",
751771
"DryRunConfigOutput$LastDryRunExecutionStatus": "<p>Returns the last execution status for a canary's dry run.</p>",
752772
"Group$Id": "<p>The unique ID of the group.</p>",
753773
"GroupSummary$Id": "<p>The unique ID of the group.</p>",

generator/ServiceModels/synthetics/synthetics-2017-10-11.normal.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,10 @@
568568
"Handler":{
569569
"shape":"CodeHandler",
570570
"documentation":"<p>The entry point to use for the source code when running the canary. For canaries that use the <code>syn-python-selenium-1.0</code> runtime or a <code>syn-nodejs.puppeteer</code> runtime earlier than <code>syn-nodejs.puppeteer-3.4</code>, the handler must be specified as <code> <i>fileName</i>.handler</code>. For <code>syn-python-selenium-1.1</code>, <code>syn-nodejs.puppeteer-3.4</code>, and later runtimes, the handler can be specified as <code> <i>fileName</i>.<i>functionName</i> </code>, or you can specify a folder where canary scripts reside as <code> <i>folder</i>/<i>fileName</i>.<i>functionName</i> </code>.</p>"
571+
},
572+
"Dependencies":{
573+
"shape":"Dependencies",
574+
"documentation":"<p>A list of dependencies that should be used for running this canary. Specify the dependencies as a key-value pair, where the key is the type of dependency and the value is the dependency reference.</p>"
571575
}
572576
},
573577
"documentation":"<p>Use this structure to input your script code for the canary. This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an Amazon S3 bucket, the bucket name, key, and version are also included. If the script was passed into the canary directly, the script code is contained in the value of <code>Zipfile</code>. </p> <p>If you are uploading your canary scripts with an Amazon S3 bucket, your zip file should include your script in a certain folder structure.</p> <ul> <li> <p>For Node.js canaries, the folder structure must be <code>nodejs/node_modules/<i>myCanaryFilename.js</i> </code> For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Nodejs.html#CloudWatch_Synthetics_Canaries_package\">Packaging your Node.js canary files</a> </p> </li> <li> <p>For Python canaries, the folder structure must be <code>python/<i>myCanaryFilename.py</i> </code> or <code>python/<i>myFolder/myCanaryFilename.py</i> </code> For more information, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary_Python.html#CloudWatch_Synthetics_Canaries_WritingCanary_Python_package\">Packaging your Python canary files</a> </p> </li> </ul>"
@@ -582,6 +586,10 @@
582586
"Handler":{
583587
"shape":"String",
584588
"documentation":"<p>The entry point to use for the source code when running the canary.</p>"
589+
},
590+
"Dependencies":{
591+
"shape":"Dependencies",
592+
"documentation":"<p>A list of dependencies that are used for running this canary. The dependencies are specified as a key-value pair, where the key is the type of dependency and the value is the dependency reference.</p>"
585593
}
586594
},
587595
"documentation":"<p>This structure contains information about the canary's Lambda handler and where its code is stored by CloudWatch Synthetics.</p>"
@@ -1031,6 +1039,31 @@
10311039
"type":"structure",
10321040
"members":{}
10331041
},
1042+
"Dependencies":{
1043+
"type":"list",
1044+
"member":{"shape":"Dependency"},
1045+
"max":1,
1046+
"min":0
1047+
},
1048+
"Dependency":{
1049+
"type":"structure",
1050+
"required":["Reference"],
1051+
"members":{
1052+
"Type":{
1053+
"shape":"DependencyType",
1054+
"documentation":"<p>The type of dependency. Valid value is <code>LambdaLayer</code>.</p>"
1055+
},
1056+
"Reference":{
1057+
"shape":"String",
1058+
"documentation":"<p>The dependency reference. For Lambda layers, this is the ARN of the Lambda layer. For more information about Lambda ARN format, see <a href=\"https://docs.aws.amazon.com/lambda/latest/api/API_Layer.html\">Lambda</a>.</p>"
1059+
}
1060+
},
1061+
"documentation":"<p>A structure that contains information about a dependency for a canary.</p>"
1062+
},
1063+
"DependencyType":{
1064+
"type":"string",
1065+
"enum":["LambdaLayer"]
1066+
},
10341067
"DescribeCanariesLastRunNameFilter":{
10351068
"type":"list",
10361069
"member":{"shape":"CanaryName"},

sdk/code-analysis/ServiceAnalysis/Synthetics/Generated/PropertyValueRules.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@
491491
<min>1</min>
492492
<max>1024</max>
493493
</property-value-rule>
494+
<property-value-rule>
495+
<property>Amazon.Synthetics.Model.Dependency.Reference</property>
496+
<min>1</min>
497+
<max>1024</max>
498+
</property-value-rule>
494499
<property-value-rule>
495500
<property>Amazon.Synthetics.Model.DryRunConfigOutput.DryRunId</property>
496501
<pattern>^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$</pattern>

sdk/src/Services/Synthetics/Generated/Model/CanaryCodeInput.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,39 @@ namespace Amazon.Synthetics.Model
5858
/// </summary>
5959
public partial class CanaryCodeInput
6060
{
61+
private List<Dependency> _dependencies = AWSConfigs.InitializeCollections ? new List<Dependency>() : null;
6162
private string _handler;
6263
private string _s3Bucket;
6364
private string _s3Key;
6465
private string _s3Version;
6566
private MemoryStream _zipFile;
6667

68+
/// <summary>
69+
/// Gets and sets the property Dependencies.
70+
/// <para>
71+
/// A list of dependencies that should be used for running this canary. Specify the dependencies
72+
/// as a key-value pair, where the key is the type of dependency and the value is the
73+
/// dependency reference.
74+
/// </para>
75+
/// <para />
76+
/// Starting with version 4 of the SDK this property will default to null. If no data for this property is returned
77+
/// from the service the property will also be null. This was changed to improve performance and allow the SDK and caller
78+
/// to distinguish between a property not set or a property being empty to clear out a value. To retain the previous
79+
/// SDK behavior set the AWSConfigs.InitializeCollections static property to true.
80+
/// </summary>
81+
[AWSProperty(Min=0, Max=1)]
82+
public List<Dependency> Dependencies
83+
{
84+
get { return this._dependencies; }
85+
set { this._dependencies = value; }
86+
}
87+
88+
// Check to see if Dependencies property is set
89+
internal bool IsSetDependencies()
90+
{
91+
return this._dependencies != null && (this._dependencies.Count > 0 || !AWSConfigs.InitializeCollections);
92+
}
93+
6794
/// <summary>
6895
/// Gets and sets the property Handler.
6996
/// <para>

sdk/src/Services/Synthetics/Generated/Model/CanaryCodeOutput.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,36 @@ namespace Amazon.Synthetics.Model
3535
/// </summary>
3636
public partial class CanaryCodeOutput
3737
{
38+
private List<Dependency> _dependencies = AWSConfigs.InitializeCollections ? new List<Dependency>() : null;
3839
private string _handler;
3940
private string _sourceLocationArn;
4041

42+
/// <summary>
43+
/// Gets and sets the property Dependencies.
44+
/// <para>
45+
/// A list of dependencies that are used for running this canary. The dependencies are
46+
/// specified as a key-value pair, where the key is the type of dependency and the value
47+
/// is the dependency reference.
48+
/// </para>
49+
/// <para />
50+
/// Starting with version 4 of the SDK this property will default to null. If no data for this property is returned
51+
/// from the service the property will also be null. This was changed to improve performance and allow the SDK and caller
52+
/// to distinguish between a property not set or a property being empty to clear out a value. To retain the previous
53+
/// SDK behavior set the AWSConfigs.InitializeCollections static property to true.
54+
/// </summary>
55+
[AWSProperty(Min=0, Max=1)]
56+
public List<Dependency> Dependencies
57+
{
58+
get { return this._dependencies; }
59+
set { this._dependencies = value; }
60+
}
61+
62+
// Check to see if Dependencies property is set
63+
internal bool IsSetDependencies()
64+
{
65+
return this._dependencies != null && (this._dependencies.Count > 0 || !AWSConfigs.InitializeCollections);
66+
}
67+
4168
/// <summary>
4269
/// Gets and sets the property Handler.
4370
/// <para>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 synthetics-2017-10-11.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Xml.Serialization;
22+
using System.Text;
23+
using System.IO;
24+
using System.Net;
25+
26+
using Amazon.Runtime;
27+
using Amazon.Runtime.Internal;
28+
29+
#pragma warning disable CS0612,CS0618,CS1570
30+
namespace Amazon.Synthetics.Model
31+
{
32+
/// <summary>
33+
/// A structure that contains information about a dependency for a canary.
34+
/// </summary>
35+
public partial class Dependency
36+
{
37+
private string _reference;
38+
private DependencyType _type;
39+
40+
/// <summary>
41+
/// Gets and sets the property Reference.
42+
/// <para>
43+
/// The dependency reference. For Lambda layers, this is the ARN of the Lambda layer.
44+
/// For more information about Lambda ARN format, see <a href="https://docs.aws.amazon.com/lambda/latest/api/API_Layer.html">Lambda</a>.
45+
/// </para>
46+
/// </summary>
47+
[AWSProperty(Required=true, Min=1, Max=1024)]
48+
public string Reference
49+
{
50+
get { return this._reference; }
51+
set { this._reference = value; }
52+
}
53+
54+
// Check to see if Reference property is set
55+
internal bool IsSetReference()
56+
{
57+
return this._reference != null;
58+
}
59+
60+
/// <summary>
61+
/// Gets and sets the property Type.
62+
/// <para>
63+
/// The type of dependency. Valid value is <c>LambdaLayer</c>.
64+
/// </para>
65+
/// </summary>
66+
public DependencyType Type
67+
{
68+
get { return this._type; }
69+
set { this._type = value; }
70+
}
71+
72+
// Check to see if Type property is set
73+
internal bool IsSetType()
74+
{
75+
return this._type != null;
76+
}
77+
78+
}
79+
}

sdk/src/Services/Synthetics/Generated/Model/Internal/MarshallTransformations/CanaryCodeInputMarshaller.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ public void Marshall(CanaryCodeInput requestObject, JsonMarshallerContext contex
4646
{
4747
if(requestObject == null)
4848
return;
49+
if(requestObject.IsSetDependencies())
50+
{
51+
context.Writer.WritePropertyName("Dependencies");
52+
context.Writer.WriteStartArray();
53+
foreach(var requestObjectDependenciesListValue in requestObject.Dependencies)
54+
{
55+
context.Writer.WriteStartObject();
56+
57+
var marshaller = DependencyMarshaller.Instance;
58+
marshaller.Marshall(requestObjectDependenciesListValue, context);
59+
60+
context.Writer.WriteEndObject();
61+
}
62+
context.Writer.WriteEndArray();
63+
}
64+
4965
if(requestObject.IsSetHandler())
5066
{
5167
context.Writer.WritePropertyName("Handler");

sdk/src/Services/Synthetics/Generated/Model/Internal/MarshallTransformations/CanaryCodeOutputUnmarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public CanaryCodeOutput Unmarshall(JsonUnmarshallerContext context, ref Streamin
5656
int targetDepth = context.CurrentDepth;
5757
while (context.ReadAtDepth(targetDepth, ref reader))
5858
{
59+
if (context.TestExpression("Dependencies", targetDepth))
60+
{
61+
var unmarshaller = new JsonListUnmarshaller<Dependency, DependencyUnmarshaller>(DependencyUnmarshaller.Instance);
62+
unmarshalledObject.Dependencies = unmarshaller.Unmarshall(context, ref reader);
63+
continue;
64+
}
5965
if (context.TestExpression("Handler", targetDepth))
6066
{
6167
var unmarshaller = StringUnmarshaller.Instance;

0 commit comments

Comments
 (0)