From 6e0e442e6446dc7f57fd5e133002105629b0860a Mon Sep 17 00:00:00 2001 From: Steven Kang Date: Mon, 24 Jul 2017 13:34:50 -0700 Subject: [PATCH] Spot Fleet tagging capability allows customers to automatically tag instances launched by Spot Fleet. You can use this feature to label or distinguish instances created by distinct Spot Fleets. Tagging your EC2 instances also enables you to see instance cost allocation by tag in your AWS bill. --- .../ec2/ec2-2016-11-15.normal.json | 46 +++++++- ...reateNetworkInterfacePermissionResponse.cs | 2 +- ...eleteNetworkInterfacePermissionResponse.cs | 2 +- ...ribeNetworkInterfacePermissionsResponse.cs | 2 +- .../RequestSpotFleetRequestMarshaller.cs | 28 +++++ ...potFleetLaunchSpecificationUnmarshaller.cs | 7 ++ .../SpotFleetTagSpecificationUnmarshaller.cs | 104 ++++++++++++++++++ .../Model/SpotFleetLaunchSpecification.cs | 19 ++++ .../Model/SpotFleetTagSpecification.cs | 75 +++++++++++++ 9 files changed, 276 insertions(+), 9 deletions(-) create mode 100644 sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetTagSpecificationUnmarshaller.cs create mode 100644 sdk/src/Services/EC2/Generated/Model/SpotFleetTagSpecification.cs diff --git a/generator/ServiceModels/ec2/ec2-2016-11-15.normal.json b/generator/ServiceModels/ec2/ec2-2016-11-15.normal.json index 86beeb23cdc5..8cfe684cce3a 100644 --- a/generator/ServiceModels/ec2/ec2-2016-11-15.normal.json +++ b/generator/ServiceModels/ec2/ec2-2016-11-15.normal.json @@ -4554,7 +4554,8 @@ "shape":"Boolean", "documentation":"

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

" } - } + }, + "documentation":"

Contains the parameters for CreateNetworkInterfacePermission.

" }, "CreateNetworkInterfacePermissionResult":{ "type":"structure", @@ -4564,7 +4565,8 @@ "documentation":"

Information about the permission for the network interface.

", "locationName":"interfacePermission" } - } + }, + "documentation":"

Contains the output of CreateNetworkInterfacePermission.

" }, "CreateNetworkInterfaceRequest":{ "type":"structure", @@ -5513,7 +5515,8 @@ "shape":"Boolean", "documentation":"

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

" } - } + }, + "documentation":"

Contains the parameters for DeleteNetworkInterfacePermission.

" }, "DeleteNetworkInterfacePermissionResult":{ "type":"structure", @@ -5523,7 +5526,8 @@ "documentation":"

Returns true if the request succeeds, otherwise returns an error.

", "locationName":"return" } - } + }, + "documentation":"

Contains the output for DeleteNetworkInterfacePermission.

" }, "DeleteNetworkInterfaceRequest":{ "type":"structure", @@ -6996,7 +7000,8 @@ "shape":"Integer", "documentation":"

The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value. If this parameter is not specified, up to 50 results are returned by default.

" } - } + }, + "documentation":"

Contains the parameters for DescribeNetworkInterfacePermissions.

" }, "DescribeNetworkInterfacePermissionsResult":{ "type":"structure", @@ -7011,7 +7016,8 @@ "documentation":"

The token to use to retrieve the next page of results.

", "locationName":"nextToken" } - } + }, + "documentation":"

Contains the output for DescribeNetworkInterfacePermissions.

" }, "DescribeNetworkInterfacesRequest":{ "type":"structure", @@ -17407,6 +17413,11 @@ "shape":"Double", "documentation":"

The number of units provided by the specified instance type. These are the same units that you chose to set the target capacity in terms (instances or a performance characteristic such as vCPUs, memory, or I/O).

If the target capacity divided by this value is not a whole number, we round the number of instances to the next whole number. If this value is not specified, the default is 1.

", "locationName":"weightedCapacity" + }, + "TagSpecifications":{ + "shape":"SpotFleetTagSpecificationList", + "documentation":"

The tags to apply during creation.

", + "locationName":"tagSpecificationSet" } }, "documentation":"

Describes the launch specification for one or more Spot instances.

" @@ -17543,6 +17554,29 @@ "locationName":"item" } }, + "SpotFleetTagSpecification":{ + "type":"structure", + "members":{ + "ResourceType":{ + "shape":"ResourceType", + "documentation":"

The type of resource. Currently, the only resource type that is supported is instance.

", + "locationName":"resourceType" + }, + "Tags":{ + "shape":"TagList", + "documentation":"

The tags.

", + "locationName":"tag" + } + }, + "documentation":"

The tags for a Spot fleet resource.

" + }, + "SpotFleetTagSpecificationList":{ + "type":"list", + "member":{ + "shape":"SpotFleetTagSpecification", + "locationName":"item" + } + }, "SpotInstanceRequest":{ "type":"structure", "members":{ diff --git a/sdk/src/Services/EC2/Generated/Model/CreateNetworkInterfacePermissionResponse.cs b/sdk/src/Services/EC2/Generated/Model/CreateNetworkInterfacePermissionResponse.cs index 727a6bc13c6b..674b18489a19 100644 --- a/sdk/src/Services/EC2/Generated/Model/CreateNetworkInterfacePermissionResponse.cs +++ b/sdk/src/Services/EC2/Generated/Model/CreateNetworkInterfacePermissionResponse.cs @@ -28,7 +28,7 @@ namespace Amazon.EC2.Model { /// - /// This is the response object from the CreateNetworkInterfacePermission operation. + /// Contains the output of CreateNetworkInterfacePermission. /// public partial class CreateNetworkInterfacePermissionResponse : AmazonWebServiceResponse { diff --git a/sdk/src/Services/EC2/Generated/Model/DeleteNetworkInterfacePermissionResponse.cs b/sdk/src/Services/EC2/Generated/Model/DeleteNetworkInterfacePermissionResponse.cs index 6519ee29f4d2..c5638ef3ec89 100644 --- a/sdk/src/Services/EC2/Generated/Model/DeleteNetworkInterfacePermissionResponse.cs +++ b/sdk/src/Services/EC2/Generated/Model/DeleteNetworkInterfacePermissionResponse.cs @@ -28,7 +28,7 @@ namespace Amazon.EC2.Model { /// - /// This is the response object from the DeleteNetworkInterfacePermission operation. + /// Contains the output for DeleteNetworkInterfacePermission. /// public partial class DeleteNetworkInterfacePermissionResponse : AmazonWebServiceResponse { diff --git a/sdk/src/Services/EC2/Generated/Model/DescribeNetworkInterfacePermissionsResponse.cs b/sdk/src/Services/EC2/Generated/Model/DescribeNetworkInterfacePermissionsResponse.cs index 6e1a5d26d652..9d0533360aa4 100644 --- a/sdk/src/Services/EC2/Generated/Model/DescribeNetworkInterfacePermissionsResponse.cs +++ b/sdk/src/Services/EC2/Generated/Model/DescribeNetworkInterfacePermissionsResponse.cs @@ -28,7 +28,7 @@ namespace Amazon.EC2.Model { /// - /// This is the response object from the DescribeNetworkInterfacePermissions operation. + /// Contains the output for DescribeNetworkInterfacePermissions. /// public partial class DescribeNetworkInterfacePermissionsResponse : AmazonWebServiceResponse { diff --git a/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/RequestSpotFleetRequestMarshaller.cs b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/RequestSpotFleetRequestMarshaller.cs index fa4610e9daca..a2d34b9dde15 100644 --- a/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/RequestSpotFleetRequestMarshaller.cs +++ b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/RequestSpotFleetRequestMarshaller.cs @@ -298,6 +298,34 @@ public IRequest Marshall(RequestSpotFleetRequest publicRequest) { request.Parameters.Add("SpotFleetRequestConfig" + "." + "LaunchSpecifications" + "." + publicRequestSpotFleetRequestConfiglistValueIndex + "." + "SubnetId", StringUtils.FromString(publicRequestSpotFleetRequestConfiglistValue.SubnetId)); } + if(publicRequestSpotFleetRequestConfiglistValue.IsSetTagSpecifications()) + { + int publicRequestSpotFleetRequestConfiglistValuelistValueIndex = 1; + foreach(var publicRequestSpotFleetRequestConfiglistValuelistValue in publicRequestSpotFleetRequestConfiglistValue.TagSpecifications) + { + if(publicRequestSpotFleetRequestConfiglistValuelistValue.IsSetResourceType()) + { + request.Parameters.Add("SpotFleetRequestConfig" + "." + "LaunchSpecifications" + "." + publicRequestSpotFleetRequestConfiglistValueIndex + "." + "TagSpecificationSet" + "." + publicRequestSpotFleetRequestConfiglistValuelistValueIndex + "." + "ResourceType", StringUtils.FromString(publicRequestSpotFleetRequestConfiglistValuelistValue.ResourceType)); + } + if(publicRequestSpotFleetRequestConfiglistValuelistValue.IsSetTags()) + { + int publicRequestSpotFleetRequestConfiglistValuelistValuelistValueIndex = 1; + foreach(var publicRequestSpotFleetRequestConfiglistValuelistValuelistValue in publicRequestSpotFleetRequestConfiglistValuelistValue.Tags) + { + if(publicRequestSpotFleetRequestConfiglistValuelistValuelistValue.IsSetKey()) + { + request.Parameters.Add("SpotFleetRequestConfig" + "." + "LaunchSpecifications" + "." + publicRequestSpotFleetRequestConfiglistValueIndex + "." + "TagSpecificationSet" + "." + publicRequestSpotFleetRequestConfiglistValuelistValueIndex + "." + "Tag" + "." + publicRequestSpotFleetRequestConfiglistValuelistValuelistValueIndex + "." + "Key", StringUtils.FromString(publicRequestSpotFleetRequestConfiglistValuelistValuelistValue.Key)); + } + if(publicRequestSpotFleetRequestConfiglistValuelistValuelistValue.IsSetValue()) + { + request.Parameters.Add("SpotFleetRequestConfig" + "." + "LaunchSpecifications" + "." + publicRequestSpotFleetRequestConfiglistValueIndex + "." + "TagSpecificationSet" + "." + publicRequestSpotFleetRequestConfiglistValuelistValueIndex + "." + "Tag" + "." + publicRequestSpotFleetRequestConfiglistValuelistValuelistValueIndex + "." + "Value", StringUtils.FromString(publicRequestSpotFleetRequestConfiglistValuelistValuelistValue.Value)); + } + publicRequestSpotFleetRequestConfiglistValuelistValuelistValueIndex++; + } + } + publicRequestSpotFleetRequestConfiglistValuelistValueIndex++; + } + } if(publicRequestSpotFleetRequestConfiglistValue.IsSetUserData()) { request.Parameters.Add("SpotFleetRequestConfig" + "." + "LaunchSpecifications" + "." + publicRequestSpotFleetRequestConfiglistValueIndex + "." + "UserData", StringUtils.FromString(publicRequestSpotFleetRequestConfiglistValue.UserData)); diff --git a/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetLaunchSpecificationUnmarshaller.cs b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetLaunchSpecificationUnmarshaller.cs index b8366119133b..9d77438f697e 100644 --- a/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetLaunchSpecificationUnmarshaller.cs +++ b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetLaunchSpecificationUnmarshaller.cs @@ -147,6 +147,13 @@ public SpotFleetLaunchSpecification Unmarshall(XmlUnmarshallerContext context) unmarshalledObject.SubnetId = unmarshaller.Unmarshall(context); continue; } + if (context.TestExpression("tagSpecificationSet/item", targetDepth)) + { + var unmarshaller = SpotFleetTagSpecificationUnmarshaller.Instance; + var item = unmarshaller.Unmarshall(context); + unmarshalledObject.TagSpecifications.Add(item); + continue; + } if (context.TestExpression("userData", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; diff --git a/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetTagSpecificationUnmarshaller.cs b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetTagSpecificationUnmarshaller.cs new file mode 100644 index 000000000000..ec80130d52ff --- /dev/null +++ b/sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/SpotFleetTagSpecificationUnmarshaller.cs @@ -0,0 +1,104 @@ +/* + * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/* + * Do not modify this file. This file is generated from the ec2-2016-11-15.normal.json service model. + */ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net; +using System.Text; +using System.Xml.Serialization; + +using Amazon.EC2.Model; +using Amazon.Runtime; +using Amazon.Runtime.Internal; +using Amazon.Runtime.Internal.Transform; +using Amazon.Runtime.Internal.Util; +namespace Amazon.EC2.Model.Internal.MarshallTransformations +{ + /// + /// Response Unmarshaller for SpotFleetTagSpecification Object + /// + public class SpotFleetTagSpecificationUnmarshaller : IUnmarshaller, IUnmarshaller + { + /// + /// Unmarshaller the response from the service to the response class. + /// + /// + /// + public SpotFleetTagSpecification Unmarshall(XmlUnmarshallerContext context) + { + SpotFleetTagSpecification unmarshalledObject = new SpotFleetTagSpecification(); + int originalDepth = context.CurrentDepth; + int targetDepth = originalDepth + 1; + + if (context.IsStartOfDocument) + targetDepth += 2; + + while (context.ReadAtDepth(originalDepth)) + { + if (context.IsStartElement || context.IsAttribute) + { + if (context.TestExpression("resourceType", targetDepth)) + { + var unmarshaller = StringUnmarshaller.Instance; + unmarshalledObject.ResourceType = unmarshaller.Unmarshall(context); + continue; + } + if (context.TestExpression("tag/item", targetDepth)) + { + var unmarshaller = TagUnmarshaller.Instance; + var item = unmarshaller.Unmarshall(context); + unmarshalledObject.Tags.Add(item); + continue; + } + } + else if (context.IsEndElement && context.CurrentDepth < originalDepth) + { + return unmarshalledObject; + } + } + + return unmarshalledObject; + } + + /// + /// Unmarshaller error response to exception. + /// + /// + /// + public SpotFleetTagSpecification Unmarshall(JsonUnmarshallerContext context) + { + return null; + } + + + private static SpotFleetTagSpecificationUnmarshaller _instance = new SpotFleetTagSpecificationUnmarshaller(); + + /// + /// Gets the singleton. + /// + public static SpotFleetTagSpecificationUnmarshaller Instance + { + get + { + return _instance; + } + } + } +} \ No newline at end of file diff --git a/sdk/src/Services/EC2/Generated/Model/SpotFleetLaunchSpecification.cs b/sdk/src/Services/EC2/Generated/Model/SpotFleetLaunchSpecification.cs index d1747ff96bc6..66938885c20e 100644 --- a/sdk/src/Services/EC2/Generated/Model/SpotFleetLaunchSpecification.cs +++ b/sdk/src/Services/EC2/Generated/Model/SpotFleetLaunchSpecification.cs @@ -47,6 +47,7 @@ public partial class SpotFleetLaunchSpecification private List _securityGroups = new List(); private string _spotPrice; private string _subnetId; + private List _tagSpecifications = new List(); private string _userData; private double? _weightedCapacity; @@ -333,6 +334,24 @@ internal bool IsSetSubnetId() return this._subnetId != null; } + /// + /// Gets and sets the property TagSpecifications. + /// + /// The tags to apply during creation. + /// + /// + public List TagSpecifications + { + get { return this._tagSpecifications; } + set { this._tagSpecifications = value; } + } + + // Check to see if TagSpecifications property is set + internal bool IsSetTagSpecifications() + { + return this._tagSpecifications != null && this._tagSpecifications.Count > 0; + } + /// /// Gets and sets the property UserData. /// diff --git a/sdk/src/Services/EC2/Generated/Model/SpotFleetTagSpecification.cs b/sdk/src/Services/EC2/Generated/Model/SpotFleetTagSpecification.cs new file mode 100644 index 000000000000..e891d33ae6ab --- /dev/null +++ b/sdk/src/Services/EC2/Generated/Model/SpotFleetTagSpecification.cs @@ -0,0 +1,75 @@ +/* + * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/* + * Do not modify this file. This file is generated from the ec2-2016-11-15.normal.json service model. + */ +using System; +using System.Collections.Generic; +using System.Xml.Serialization; +using System.Text; +using System.IO; + +using Amazon.Runtime; +using Amazon.Runtime.Internal; + +namespace Amazon.EC2.Model +{ + /// + /// The tags for a Spot fleet resource. + /// + public partial class SpotFleetTagSpecification + { + private ResourceType _resourceType; + private List _tags = new List(); + + /// + /// Gets and sets the property ResourceType. + /// + /// The type of resource. Currently, the only resource type that is supported is instance. + /// + /// + public ResourceType ResourceType + { + get { return this._resourceType; } + set { this._resourceType = value; } + } + + // Check to see if ResourceType property is set + internal bool IsSetResourceType() + { + return this._resourceType != null; + } + + /// + /// Gets and sets the property Tags. + /// + /// The tags. + /// + /// + public List Tags + { + get { return this._tags; } + set { this._tags = value; } + } + + // Check to see if Tags property is set + internal bool IsSetTags() + { + return this._tags != null && this._tags.Count > 0; + } + + } +} \ No newline at end of file