コード例 #1
0
        public async Task <CreateInternetGatewayResponse> CreateInternetGatewayAsync()
        {
            var request  = new CreateInternetGatewayRequest();
            var response = await _cloudComputeClient.CreateInternetGatewayAsync();

            return(response);
        }
コード例 #2
0
ファイル: AWSEC2Utils.cs プロジェクト: ohga/USIEngineOnAWS
        public bool load_internet_gateway_id()
        {
            write_log(region + " のインターネットゲートウェイを確認しています。");
            try
            {
                var client    = get_client();
                var query_req = new DescribeInternetGatewaysRequest();
                query_req.Filters.Add(new Filter()
                {
                    Name = "tag-value", Values = new List <string>()
                    {
                        Helper.build_name(setting_, "igw")
                    }
                });
                var query_res = client.DescribeInternetGateways(query_req);
                if (query_res.InternetGateways.Count != 0)
                {
                    foreach (var row in query_res.InternetGateways[0].Attachments)
                    {
                        if (row.VpcId.Equals(vpc_id))
                        {
                            internet_gateway_id = query_res.InternetGateways[0].InternetGatewayId;
                            write_log(vpc_id + " のインターネットゲートウェイは " + internet_gateway_id + " です");
                            return(true);
                        }
                    }
                }

                write_log(region + " にインターネットゲートウェイを作成しています。");
                var create_req = new CreateInternetGatewayRequest();
                var create_res = client.CreateInternetGateway(create_req);

                set_name_tag(client, create_res.InternetGateway.InternetGatewayId, Helper.build_name(setting_, "igw"));
                internet_gateway_id = create_res.InternetGateway.InternetGatewayId;
                write_log("インターネットゲートウェイ " + internet_gateway_id + " を作成しました。");


                write_log("VPC " + vpc_id + " に " + internet_gateway_id + " を関連付けます。");
                var attach_req = new AttachInternetGatewayRequest();
                attach_req.InternetGatewayId = internet_gateway_id;
                attach_req.VpcId             = vpc_id;
                client.AttachInternetGateway(attach_req);
            }
            catch (Exception ex)
            {
                write_log("ERROR: " + ex.ToString());
                return(false);
            }
            return(true);
        }
コード例 #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            CreateInternetGatewayRequest request;

            try
            {
                request = new CreateInternetGatewayRequest
                {
                    CreateInternetGatewayDetails = CreateInternetGatewayDetails,
                    OpcRetryToken = OpcRetryToken
                };

                response = client.CreateInternetGateway(request).GetAwaiter().GetResult();
                WriteOutput(response, response.InternetGateway);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
コード例 #4
0
        private static async Task <InternetGateway> CreateInternalGateway(VirtualNetworkClient vcnClient, string compartmentId, Vcn vcn)
        {
            CreateInternetGatewayDetails createInternetGatewayDetails = new CreateInternetGatewayDetails
            {
                CompartmentId = compartmentId,
                DisplayName   = IgName,
                IsEnabled     = true,
                VcnId         = vcn.Id
            };
            CreateInternetGatewayRequest createInternetGatewayRequest = new CreateInternetGatewayRequest {
                CreateInternetGatewayDetails = createInternetGatewayDetails
            };
            CreateInternetGatewayResponse createInternetGatewayResponse = await vcnClient.CreateInternetGateway(createInternetGatewayRequest);

            GetInternetGatewayRequest getInternetGatewayRequest = new GetInternetGatewayRequest {
                IgId = createInternetGatewayResponse.InternetGateway.Id
            };
            GetInternetGatewayResponse getInternetGatewayResponse = vcnClient.Waiters.ForInternetGateway(getInternetGatewayRequest, InternetGateway.LifecycleStateEnum.Available).Execute();
            InternetGateway            internetGateway            = getInternetGatewayResponse.InternetGateway;

            logger.Info($"Created internet gateway: {internetGateway.Id} and state is {internetGateway.LifecycleState}");
            return(internetGateway);
        }
コード例 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInternetGateway operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInternetGateway operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<CreateInternetGatewayResponse> CreateInternetGatewayAsync(CreateInternetGatewayRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInternetGatewayRequestMarshaller();
            var unmarshaller = CreateInternetGatewayResponseUnmarshaller.Instance;

            return InvokeAsync<CreateInternetGatewayRequest,CreateInternetGatewayResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #6
0
        /// <summary>
        /// Creates an Internet gateway for use with a VPC. After creating the Internet gateway,
        /// you attach it to a VPC using <a>AttachInternetGateway</a>.
        /// 
        ///  
        /// <para>
        /// For more information about your VPC and Internet gateway, see the <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/">Amazon
        /// Virtual Private Cloud User Guide</a>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateInternetGateway service method.</param>
        /// 
        /// <returns>The response from the CreateInternetGateway service method, as returned by EC2.</returns>
        public CreateInternetGatewayResponse CreateInternetGateway(CreateInternetGatewayRequest request)
        {
            var marshaller = new CreateInternetGatewayRequestMarshaller();
            var unmarshaller = CreateInternetGatewayResponseUnmarshaller.Instance;

            return Invoke<CreateInternetGatewayRequest,CreateInternetGatewayResponse>(request, marshaller, unmarshaller);
        }
コード例 #7
0
ファイル: AmazonEC2Client.cs プロジェクト: aws/aws-sdk-net
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInternetGateway operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInternetGateway operation on AmazonEC2Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateInternetGateway
        ///         operation.</returns>
        public IAsyncResult BeginCreateInternetGateway(CreateInternetGatewayRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateInternetGatewayRequestMarshaller();
            var unmarshaller = CreateInternetGatewayResponseUnmarshaller.Instance;

            return BeginInvoke<CreateInternetGatewayRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #8
0
 IAsyncResult invokeCreateInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateInternetGatewayRequestMarshaller().Marshall(createInternetGatewayRequest);
     var unmarshaller = CreateInternetGatewayResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
コード例 #9
0
 /// <summary>
 /// Initiates the asynchronous execution of the CreateInternetGateway operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateInternetGateway"/>
 /// </summary>
 /// 
 /// <param name="createInternetGatewayRequest">Container for the necessary parameters to execute the CreateInternetGateway operation on
 ///          AmazonEC2.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// 
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking
 ///         EndCreateInternetGateway operation.</returns>
 public IAsyncResult BeginCreateInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest, AsyncCallback callback, object state)
 {
     return invokeCreateInternetGateway(createInternetGatewayRequest, callback, state, false);
 }
コード例 #10
0
 /// <summary>
 /// <para>Creates an Internet gateway for use with a VPC. After creating the Internet gateway, you attach it to a VPC using
 /// AttachInternetGateway.</para> <para>For more information about your VPC and Internet gateway, see the <a
 /// href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/" >Amazon Virtual Private Cloud User Guide</a> .</para>
 /// </summary>
 /// 
 /// <param name="createInternetGatewayRequest">Container for the necessary parameters to execute the CreateInternetGateway service method on
 ///          AmazonEC2.</param>
 /// 
 /// <returns>The response from the CreateInternetGateway service method, as returned by AmazonEC2.</returns>
 /// 
 public CreateInternetGatewayResponse CreateInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest)
 {
     IAsyncResult asyncResult = invokeCreateInternetGateway(createInternetGatewayRequest, null, null, true);
     return EndCreateInternetGateway(asyncResult);
 }
コード例 #11
0
ファイル: AmazonEC2Client.cs プロジェクト: virajs/aws-sdk-net
		internal CreateInternetGatewayResponse CreateInternetGateway(CreateInternetGatewayRequest request)
        {
            var task = CreateInternetGatewayAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
コード例 #12
0
ファイル: AmazonEC2Client.cs プロジェクト: virajs/aws-sdk-net
        /// <summary>
        /// <para>Creates an Internet gateway for use with a VPC. After creating the Internet gateway, you attach it to a VPC using
        /// AttachInternetGateway.</para> <para>For more information about your VPC and Internet gateway, see the <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/">Amazon Virtual Private Cloud User Guide</a> .</para>
        /// </summary>
        /// 
        /// <param name="createInternetGatewayRequest">Container for the necessary parameters to execute the CreateInternetGateway service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateInternetGateway service method, as returned by AmazonEC2.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<CreateInternetGatewayResponse> CreateInternetGatewayAsync(CreateInternetGatewayRequest createInternetGatewayRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInternetGatewayRequestMarshaller();
            var unmarshaller = CreateInternetGatewayResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateInternetGatewayRequest, CreateInternetGatewayResponse>(createInternetGatewayRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
コード例 #13
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInternetGateway operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateInternetGateway"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInternetGateway operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<CreateInternetGatewayResponse> CreateInternetGatewayAsync(CreateInternetGatewayRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInternetGatewayRequestMarshaller();
            var unmarshaller = CreateInternetGatewayResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateInternetGatewayRequest, CreateInternetGatewayResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
コード例 #14
0
        /// <summary>
        /// <para> Creates a new Internet gateway in your AWS account. After creating the Internet gateway, you then attach it to a VPC using
        /// <c>AttachInternetGateway</c> . For more information about your VPC and Internet gateway, go to Amazon Virtual Private Cloud User Guide.
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInternetGateway service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateInternetGateway service method, as returned by AmazonEC2.</returns>
		public CreateInternetGatewayResponse CreateInternetGateway(CreateInternetGatewayRequest request)
        {
            var task = CreateInternetGatewayAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }