Ejemplo n.º 1
0
        internal Deployment(DeploymentGetResponse response)
            : this()
        {
            if (response.PersistentVMDowntime != null)
            {
                PersistentVMDowntime = new PersistentVMDowntimeInfo(response.PersistentVMDowntime);
            }

            Name = response.Name;
            DeploymentSlot = response.DeploymentSlot == Management.Compute.Models.DeploymentSlot.Staging ? "Staging" : "Production";
            PrivateID = response.PrivateId;
            Status = DeploymentStatusFactory.From(response.Status);
            Label = response.Label;
            Url = response.Uri;
            Configuration = response.Configuration;
            foreach (var roleInstance in response.RoleInstances.Select(ri => new RoleInstance(ri)))
            {
                RoleInstanceList.Add(roleInstance);
            }

            if (response.UpgradeStatus != null)
            {
                UpgradeStatus = new UpgradeStatus(response.UpgradeStatus);
            }

            UpgradeDomainCount = response.UpgradeDomainCount;
            if (response.Roles != null)
            {
                foreach (var role in response.Roles.Select(r => new Role(r)))
                {
                    RoleList.Add(role);
                }
            }
            SdkVersion = response.SdkVersion;
            Locked = response.Locked;
            RollbackAllowed = response.RollbackAllowed;
            VirtualNetworkName = response.VirtualNetworkName;
            CreatedTime = response.CreatedTime;
            LastModifiedTime = response.LastModifiedTime;

            if (response.ExtendedProperties != null)
            {
                foreach (var prop in response.ExtendedProperties.Keys)
                {
                    ExtendedProperties[prop] = response.ExtendedProperties[prop];
                }
            }

            if (response.DnsSettings != null)
            {
                Dns = new DnsSettings(response.DnsSettings);
            }
            if (response.VirtualIPAddresses != null)
            {
                foreach (var vip in response.VirtualIPAddresses.Select(v => new VirtualIP(v)))
                {
                    VirtualIPs.Add(vip);
                }
            }
        }