Skip to content

Commit

Permalink
The CreateDefaultVPC API enables you to create a new default VPC . Yo…
Browse files Browse the repository at this point in the history
…u no longer need to contact AWS support, if your default VPC has been deleted.
  • Loading branch information
sstevenkang committed Jul 27, 2017
1 parent 149f1c3 commit 4332ac8
Show file tree
Hide file tree
Showing 12 changed files with 613 additions and 0 deletions.
31 changes: 31 additions & 0 deletions generator/ServiceModels/ec2/ec2-2016-11-15.normal.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@
"output":{"shape":"CreateCustomerGatewayResult"},
"documentation":"<p>Provides information to AWS about your VPN customer gateway device. The customer gateway is the appliance at your end of the VPN connection. (The device on the AWS side of the VPN connection is the virtual private gateway.) You must provide the Internet-routable IP address of the customer gateway's external interface. The IP address must be static and may be behind a device performing network address translation (NAT).</p> <p>For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN (in the 64512 - 65534 range).</p> <note> <p>Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception of 7224, which is reserved in the <code>us-east-1</code> region, and 9059, which is reserved in the <code>eu-west-1</code> region.</p> </note> <p>For more information about VPN customer gateways, see <a href=\"http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html\">Adding a Hardware Virtual Private Gateway to Your VPC</a> in the <i>Amazon Virtual Private Cloud User Guide</i>.</p> <important> <p>You cannot create more than one customer gateway with the same VPN type, IP address, and BGP ASN parameter values. If you run an identical request more than one time, the first request creates the customer gateway, and subsequent requests return information about the existing customer gateway. The subsequent requests do not create new customer gateway resources.</p> </important>"
},
"CreateDefaultVpc":{
"name":"CreateDefaultVpc",
"http":{
"method":"POST",
"requestUri":"/"
},
"input":{"shape":"CreateDefaultVpcRequest"},
"output":{"shape":"CreateDefaultVpcResult"},
"documentation":"<p>Creates a default VPC with a size <code>/16</code> IPv4 CIDR block and a default subnet in each Availability Zone. For more information about the components of a default VPC, see <a href=\"http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html\">Default VPC and Default Subnets</a> in the <i>Amazon Virtual Private Cloud User Guide</i>. You cannot specify the components of the default VPC yourself.</p> <p>You can create a default VPC if you deleted your previous default VPC. You cannot have more than one default VPC per region. </p> <p>If your account supports EC2-Classic, you cannot use this action to create a default VPC in a region that supports EC2-Classic. If you want a default VPC in a region that supports EC2-Classic, see \"I really want a default VPC for my existing EC2 account. Is that possible?\" in the <a href=\"http://aws.amazon.com/vpc/faqs/#Default_VPCs\">Default VPCs FAQ</a>.</p>"
},
"CreateDhcpOptions":{
"name":"CreateDhcpOptions",
"http":{
Expand Down Expand Up @@ -4116,6 +4126,27 @@
},
"documentation":"<p>Contains the output of CreateCustomerGateway.</p>"
},
"CreateDefaultVpcRequest":{
"type":"structure",
"members":{
"DryRun":{
"shape":"Boolean",
"documentation":"<p>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 <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>"
}
},
"documentation":"<p>Contains the parameters for CreateDefaultVpc.</p>"
},
"CreateDefaultVpcResult":{
"type":"structure",
"members":{
"Vpc":{
"shape":"Vpc",
"documentation":"<p>Information about the VPC.</p>",
"locationName":"vpc"
}
},
"documentation":"<p>Contains the output of CreateDefaultVpc.</p>"
},
"CreateDhcpOptionsRequest":{
"type":"structure",
"required":["DhcpConfigurations"],
Expand Down
56 changes: 56 additions & 0 deletions sdk/src/Services/EC2/Generated/Model/CreateDefaultVpcRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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
{
/// <summary>
/// Container for the parameters to the CreateDefaultVpc operation.
/// Creates a default VPC with a size <code>/16</code> IPv4 CIDR block and a default subnet
/// in each Availability Zone. For more information about the components of a default
/// VPC, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html">Default
/// VPC and Default Subnets</a> in the <i>Amazon Virtual Private Cloud User Guide</i>.
/// You cannot specify the components of the default VPC yourself.
///
///
/// <para>
/// You can create a default VPC if you deleted your previous default VPC. You cannot
/// have more than one default VPC per region.
/// </para>
///
/// <para>
/// If your account supports EC2-Classic, you cannot use this action to create a default
/// VPC in a region that supports EC2-Classic. If you want a default VPC in a region that
/// supports EC2-Classic, see "I really want a default VPC for my existing EC2 account.
/// Is that possible?" in the <a href="http://aws.amazon.com/vpc/faqs/#Default_VPCs">Default
/// VPCs FAQ</a>.
/// </para>
/// </summary>
public partial class CreateDefaultVpcRequest : AmazonEC2Request
{

}
}
56 changes: 56 additions & 0 deletions sdk/src/Services/EC2/Generated/Model/CreateDefaultVpcResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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
{
/// <summary>
/// Contains the output of CreateDefaultVpc.
/// </summary>
public partial class CreateDefaultVpcResponse : AmazonWebServiceResponse
{
private Vpc _vpc;

/// <summary>
/// Gets and sets the property Vpc.
/// <para>
/// Information about the VPC.
/// </para>
/// </summary>
public Vpc Vpc
{
get { return this._vpc; }
set { this._vpc = value; }
}

// Check to see if Vpc property is set
internal bool IsSetVpc()
{
return this._vpc != null;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.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
{
/// <summary>
/// CreateDefaultVpc Request Marshaller
/// </summary>
public class CreateDefaultVpcRequestMarshaller : IMarshaller<IRequest, CreateDefaultVpcRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((CreateDefaultVpcRequest)input);
}

/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(CreateDefaultVpcRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.EC2");
request.Parameters.Add("Action", "CreateDefaultVpc");
request.Parameters.Add("Version", "2016-11-15");

if(publicRequest != null)
{
}
return request;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* 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
{
/// <summary>
/// Response Unmarshaller for CreateDefaultVpc operation
/// </summary>
public class CreateDefaultVpcResponseUnmarshaller : EC2ResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
{
CreateDefaultVpcResponse response = new CreateDefaultVpcResponse();

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("vpc", targetDepth))
{
var unmarshaller = VpcUnmarshaller.Instance;
response.Vpc = unmarshaller.Unmarshall(context);
continue;
}
}
}

return response;
}

/// <summary>
/// Unmarshaller error response to exception.
/// </summary>
/// <param name="context"></param>
/// <param name="innerException"></param>
/// <param name="statusCode"></param>
/// <returns></returns>
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
return new AmazonEC2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
}
private static CreateDefaultVpcResponseUnmarshaller _instance = new CreateDefaultVpcResponseUnmarshaller();

internal static CreateDefaultVpcResponseUnmarshaller GetInstance()
{
return _instance;
}

/// <summary>
/// Gets the singleton.
/// </summary>
public static CreateDefaultVpcResponseUnmarshaller Instance
{
get
{
return _instance;
}
}

}
}
Loading

0 comments on commit 4332ac8

Please sign in to comment.