Exemplo n.º 1
0
        public IEnumerable <PowerShellAppGwModel.ApplicationGateway> ListApplicationGateway()
        {
            ApplicationGatewayListResponse gatewayList = client.ApplicationGateways.List();

            List <ApplicationGateway.Model.ApplicationGateway> psGatewayList = new List <ApplicationGateway.Model.ApplicationGateway>();

            foreach (ApplicationGatewayGetResponse gateway in gatewayList.ApplicationGateways)
            {
                PowerShellAppGwModel.SubnetCollection subnets = new PowerShellAppGwModel.SubnetCollection();
                foreach (string subnet in gateway.Subnets)
                {
                    subnets.Add(subnet);
                }

                PowerShellAppGwModel.VirtualIpCollection VirtualIPs = new PowerShellAppGwModel.VirtualIpCollection();
                foreach (string vip in gateway.VirtualIPs)
                {
                    VirtualIPs.Add(vip);
                }

                psGatewayList.Add(new PowerShellAppGwModel.ApplicationGateway
                {
                    Name          = gateway.Name,
                    Description   = gateway.Description,
                    GatewaySize   = gateway.GatewaySize,
                    InstanceCount = gateway.InstanceCount,
                    VnetName      = gateway.VnetName,
                    Subnets       = subnets,
                    State         = gateway.State,
                    VirtualIPs    = VirtualIPs,
                    DnsName       = gateway.DnsName
                });
            }
            return(psGatewayList);
        }
Exemplo n.º 2
0
        public PowerShellAppGwModel.ApplicationGateway GetApplicationGateway(string gatewayName)
        {
            ApplicationGatewayGetResponse parameters = client.ApplicationGateways.Get(gatewayName);

            PowerShellAppGwModel.SubnetCollection subnets = new PowerShellAppGwModel.SubnetCollection();
            foreach (string subnet in parameters.Subnets)
            {
                subnets.Add(subnet);
            }

            PowerShellAppGwModel.VirtualIpCollection VirtualIPs = new PowerShellAppGwModel.VirtualIpCollection();
            foreach (string vip in parameters.VirtualIPs)
            {
                VirtualIPs.Add(vip);
            }

            return(new ApplicationGateway.Model.ApplicationGateway
            {
                Name = parameters.Name,
                Description = parameters.Description,
                GatewaySize = parameters.GatewaySize,
                InstanceCount = parameters.InstanceCount,
                VnetName = parameters.VnetName,
                Subnets = subnets,
                State = parameters.State,
                VirtualIPs = VirtualIPs,
                DnsName = parameters.DnsName
            });
        }