public Profile ToSDKProfile()
        {
            var profile = new Profile
            {
                Id = this.Id,
                Name = this.Name,
                Type = Constants.ProfileType,
                Location = TrafficManagerClient.ProfileResourceLocation,
                Properties = new ProfileProperties
                {
                    ProfileStatus = this.ProfileStatus,
                    TrafficRoutingMethod = this.TrafficRoutingMethod,
                    DnsConfig = new DnsConfig
                    {
                        RelativeName = this.RelativeDnsName,
                        Ttl = this.Ttl
                    },
                    MonitorConfig = new MonitorConfig
                    {
                        Protocol = this.MonitorProtocol,
                        Port = this.MonitorPort,
                        Path = this.MonitorPath
                    }
                }
            };

            if (this.Endpoints != null && this.Endpoints.Any())
            {
                profile.Properties.Endpoints = this.Endpoints.Select(endpoint => endpoint.ToSDKEndpoint()).ToList();
            }

            return profile;
        }
 /// <summary>
 /// Initializes a new instance of the ProfileCreateOrUpdateParameters
 /// class with required arguments.
 /// </summary>
 public ProfileCreateOrUpdateParameters(Profile profile)
     : this()
 {
     if (profile == null)
     {
         throw new ArgumentNullException("profile");
     }
     this.Profile = profile;
 }
 /// <summary>
 /// Initializes a new instance of the ProfileUpdateResponse class with
 /// required arguments.
 /// </summary>
 public ProfileUpdateResponse(Profile profile)
     : this()
 {
     if (profile == null)
     {
         throw new ArgumentNullException("profile");
     }
     this.Profile = profile;
 }
        public Profile ToSDKProfile()
        {
            var profile = new Profile
            {
                Name = this.Name,
                Type = Constants.ProfileType,
                Location = TrafficManagerClient.ProfileResourceLocation,
                Properties = new ProfileProperties
                {
                    TrafficRoutingMethod = this.TrafficRoutingMethod,
                    DnsConfig = new DnsConfig
                    {
                        RelativeName = this.RelativeDnsName,
                        Ttl = this.Ttl
                    },
                    MonitorConfig = new MonitorConfig
                    {
                        Protocol = this.MonitorProtocol,
                        Port = this.MonitorPort,
                        Path = this.MonitorPath
                    }
                }
            };

            if (this.Endpoints.Count > 0)
            {
                profile.Properties.Endpoints = new List<Management.TrafficManager.Models.Endpoint>();

                foreach (Endpoint endpoint in this.Endpoints)
                {
                    profile.Properties.Endpoints.Add(new Management.TrafficManager.Models.Endpoint
                    {
                        Name = endpoint.Name,
                        Type = endpoint.Type,
                        Properties = new EndpointProperties
                        {
                            Target = endpoint.Target,
                            EndpointStatus = endpoint.EndpointStatus,
                            Weight = endpoint.Weight,
                            Priority = endpoint.Priority,
                            EndpointLocation = endpoint.Location
                        }
                    });
                }    
            }

            return profile;
        }
        private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, Profile mamlProfile)
        {
            var profile = new TrafficManagerProfile
            {
                Id = mamlProfile.Id,
                Name = profileName,
                ResourceGroupName = resourceGroupName,
                ProfileStatus = mamlProfile.Properties.ProfileStatus,
                RelativeDnsName = mamlProfile.Properties.DnsConfig.RelativeName,
                Ttl = mamlProfile.Properties.DnsConfig.Ttl,
                TrafficRoutingMethod = mamlProfile.Properties.TrafficRoutingMethod,
                MonitorProtocol = mamlProfile.Properties.MonitorConfig.Protocol,
                MonitorPort = mamlProfile.Properties.MonitorConfig.Port,
                MonitorPath = mamlProfile.Properties.MonitorConfig.Path
            };

            if (mamlProfile.Properties.Endpoints != null)
            {
                profile.Endpoints = new List<TrafficManagerEndpoint>();

                foreach (Endpoint endpoint in mamlProfile.Properties.Endpoints)
                {
                    profile.Endpoints.Add(new TrafficManagerEndpoint
                    {
                        Id = endpoint.Id,
                        ResourceGroupName = resourceGroupName,
                        ProfileName = profileName,
                        Name = endpoint.Name,
                        Type = endpoint.Type,
                        TargetResourceId = endpoint.Properties.TargetResourceId,
                        Target = endpoint.Properties.Target,
                        EndpointStatus = endpoint.Properties.EndpointStatus,
                        Location = endpoint.Properties.EndpointLocation,
                        Priority = endpoint.Properties.Priority,
                        Weight = endpoint.Properties.Weight,
                        EndpointMonitorStatus = endpoint.Properties.EndpointMonitorStatus,
                        MinChildEndpoints = endpoint.Properties.MinChildEndpoints,
                    });
                }
            }

            return profile;
        }