Exemplo n.º 1
0
        /****************************************** VPC Peering Connection ******************************************/
        public async Task <SA_PeeringConnection> GetPeeringConnection(string name)
        {
            var request  = new DescribeVpcPeeringConnectionsRequest();
            var response = await client.DescribeVpcPeeringConnectionsAsync(request);

            var connection = response.VpcPeeringConnections.
                             FindAll(o => (o.Tags.FindIndex(p => p.Key == "Name" && p.Value == name) >= 0)).
                             Find(o => o.Status.Code == VpcPeeringConnectionStateReasonCode.Active);

            if (connection != null)
            {
                var connectionModel = new SA_PeeringConnection()
                {
                    AccepterVpc            = connection.AccepterVpcInfo.VpcId,
                    RequesterVpc           = connection.RequesterVpcInfo.VpcId,
                    VpcPeeringConnectionId = connection.VpcPeeringConnectionId,
                    Status = connection.Status.Code.Value
                };
                return(connectionModel);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        //-----------------------------------------------Peering Connection Tab--------------------------------------------------------------

        private async Task PopulatePeeringConnection()
        {
            var service = new VpcPeeringConnectionServices();

            vpcPeeringConnection = await service.GetRdsPeeringConnection();

            if (vpcPeeringConnection == null || vpcPeeringConnection.Status.ToLower() == "deleted")
            {
                pnlNonExistRpc.Show();
                //pnlExistRpc.Visible = false;
                pnlExistRpc.Hide();
                pnlNonExistRpc.Location = pnlExistRpc.Location;
                //The peering connection which is under status of "deleted",
                //should be considered as null when create a new one.
                vpcPeeringConnection = null;
            }
            else
            {
                pnlNonExistRpc.Hide();
                //pnlVPCPeeringConnection.Visible = false;
                pnlExistRpc.Show();
                pnlExistRpc.Visible  = true;
                lblRpcId.Text        = vpcPeeringConnection.VpcPeeringConnectionId;
                lblRpcReuestVpc.Text = vpcPeeringConnection.RequesterVpc;
                lblRpcAcceptVpc.Text = vpcPeeringConnection.AccepterVpc;
                lblRpcStatus.Text    = vpcPeeringConnection.Status;
            }
        }