public static Profile BuildProfile(
     string id,
     string name,
     string type,
     string location,
     Dictionary <string, string> tags,
     string profileStatus,
     string trafficRoutingMethod,
     string trafficViewEnrollmentStatus,
     long?maxReturn,
     DnsConfig dnsConfig,
     MonitorConfig monitorConfig,
     Endpoint[] endpoints)
 {
     return(new Profile(
                id: id,
                name: name,
                type: type,
                location: location,
                tags: tags,
                profileStatus: profileStatus,
                trafficRoutingMethod: trafficRoutingMethod,
                trafficViewEnrollmentStatus: trafficViewEnrollmentStatus,
                maxReturn: maxReturn,
                dnsConfig: dnsConfig,
                monitorConfig: monitorConfig,
                endpoints: endpoints));
 }
Exemplo n.º 2
0
        internal override string GetServerUrl(string serverUrl, string apiName, string session)
        {
            DnsConfig dnsConfig = ClusterManager.GetDnsConfigFromCache();

            if (dnsConfig == null)
            {
                return(serverUrl);
            }
            else
            {
                return(dnsConfig.GetBestVipUrl(serverUrl, apiName, session));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Containers == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Containers");
     }
     if (OsType == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "OsType");
     }
     if (Containers != null)
     {
         foreach (var element in Containers)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (ImageRegistryCredentials != null)
     {
         foreach (var element1 in ImageRegistryCredentials)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (IpAddress != null)
     {
         IpAddress.Validate();
     }
     if (Volumes != null)
     {
         foreach (var element2 in Volumes)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
     if (Diagnostics != null)
     {
         Diagnostics.Validate();
     }
     if (SubnetIds != null)
     {
         foreach (var element3 in SubnetIds)
         {
             if (element3 != null)
             {
                 element3.Validate();
             }
         }
     }
     if (DnsConfig != null)
     {
         DnsConfig.Validate();
     }
     if (EncryptionProperties != null)
     {
         EncryptionProperties.Validate();
     }
     if (InitContainers != null)
     {
         foreach (var element4 in InitContainers)
         {
             if (element4 != null)
             {
                 element4.Validate();
             }
         }
     }
 }
 public static Profile BuildProfile(string id, string name, string type, string location, Dictionary <string, string> tags, string profileStatus, string trafficRoutingMethod, DnsConfig dnsConfig, MonitorConfig monitorConfig, Endpoint[] endpoints)
 {
     return(new Microsoft.Azure.Management.TrafficManager.Models.Profile
     {
         Id = id,
         Name = name,
         Type = type,
         Location = location,
         Tags = tags,
         Properties = new Microsoft.Azure.Management.TrafficManager.Models.ProfileProperties
         {
             ProfileStatus = profileStatus,
             TrafficRoutingMethod = trafficRoutingMethod,
             DnsConfig = dnsConfig,
             MonitorConfig = monitorConfig,
             Endpoints = endpoints
         }
     });
 }