Example #1
0
        public TrafficManagerProfile CreateTrafficManagerProfile(string resourceGroupName, string profileName, string profileStatus, string trafficRoutingMethod, string relativeDnsName, uint ttl, string monitorProtocol, uint monitorPort, string monitorPath, Hashtable[] tag)
        {
            ProfileCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                resourceGroupName,
                profileName,
                new ProfileCreateOrUpdateParameters
            {
                Profile = new Profile
                {
                    Name       = profileName,
                    Location   = TrafficManagerClient.ProfileResourceLocation,
                    Properties = new ProfileProperties
                    {
                        ProfileStatus        = profileStatus,
                        TrafficRoutingMethod = trafficRoutingMethod,
                        DnsConfig            = new DnsConfig
                        {
                            RelativeName = relativeDnsName,
                            Ttl          = ttl
                        },
                        MonitorConfig = new MonitorConfig
                        {
                            Protocol = monitorProtocol,
                            Port     = monitorPort,
                            Path     = monitorPath
                        }
                    },
                    Tags = TagsConversionHelper.CreateTagDictionary(tag, validate: true),
                }
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(resourceGroupName, profileName, response.Profile));
        }
Example #2
0
        public TrafficManagerEndpoint CreateTrafficManagerEndpoint(string resourceGroupName, string profileName, string endpointType, string endpointName, string targetResourceId, string target, string endpointStatus, uint?weight, uint?priority, string endpointLocation, uint?minChildEndpoints)
        {
            EndpointCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                resourceGroupName,
                profileName,
                endpointType,
                endpointName,
                new EndpointCreateOrUpdateParameters
            {
                Endpoint = new Endpoint
                {
                    Name       = endpointName,
                    Type       = TrafficManagerEndpoint.ToSDKEndpointType(endpointType),
                    Properties = new EndpointProperties
                    {
                        TargetResourceId  = targetResourceId,
                        Target            = target,
                        EndpointStatus    = endpointStatus,
                        Weight            = weight,
                        Priority          = priority,
                        EndpointLocation  = endpointLocation,
                        MinChildEndpoints = minChildEndpoints,
                    }
                }
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(response.Endpoint.Id, resourceGroupName, profileName, endpointType, endpointName, response.Endpoint.Properties));
        }
        public TrafficManagerProfile CreateTrafficManagerProfile(string resourceGroupName, string profileName, string profileStatus, string trafficRoutingMethod, string relativeDnsName, uint ttl, string monitorProtocol, uint monitorPort, string monitorPath, int?monitorInterval, int?monitorTimeout, int?monitorToleratedNumberOfFailures, Hashtable tag)
        {
            Profile response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                resourceGroupName,
                profileName,
                new Profile(name: profileName, location: TrafficManagerClient.ProfileResourceLocation)
            {
                ProfileStatus        = profileStatus,
                TrafficRoutingMethod = trafficRoutingMethod,
                DnsConfig            = new DnsConfig
                {
                    RelativeName = relativeDnsName,
                    Ttl          = ttl
                },
                MonitorConfig = new MonitorConfig
                {
                    Protocol                  = monitorProtocol,
                    Port                      = monitorPort,
                    Path                      = monitorPath,
                    IntervalInSeconds         = monitorInterval,
                    TimeoutInSeconds          = monitorTimeout,
                    ToleratedNumberOfFailures = monitorToleratedNumberOfFailures,
                },
                Tags = TagsConversionHelper.CreateTagDictionary(tag, validate: true),
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(resourceGroupName, profileName, response));
        }
        public TrafficManagerProfile CreateTrafficManagerProfile(string resourceGroupName, string profileName, string trafficRoutingMethod, string relativeDnsName, uint ttl, string monitorProtocol, uint monitorPort, string monitorPath)
        {
            ProfileCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                resourceGroupName,
                profileName,
                new ProfileCreateOrUpdateParameters
            {
                Profile = new Profile
                {
                    Name       = profileName,
                    Location   = TrafficManagerClient.ProfileResourceLocation,
                    Properties = new ProfileProperties
                    {
                        TrafficRoutingMethod = trafficRoutingMethod,
                        DnsConfig            = new DnsConfig
                        {
                            RelativeName = relativeDnsName,
                            Ttl          = ttl
                        },
                        MonitorConfig = new MonitorConfig
                        {
                            Protocol = monitorProtocol,
                            Port     = monitorPort,
                            Path     = monitorPath
                        }
                    }
                }
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(resourceGroupName, profileName, response.Profile.Properties));
        }
        public TrafficManagerEndpoint GetTrafficManagerEndpoint(string resourceGroupName, string profileName, string endpointType, string endpointName)
        {
            EndpointGetResponse response = this.TrafficManagerManagementClient.Endpoints.Get(resourceGroupName, profileName, endpointType, endpointName);

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(
                       resourceGroupName,
                       profileName,
                       endpointType,
                       endpointName,
                       response.Endpoint.Properties));
        }
Example #6
0
        public TrafficManagerProfile SetTrafficManagerProfile(TrafficManagerProfile profile)
        {
            Profile profileToSet = profile.ToSDKProfile();

            Profile response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                profile.ResourceGroupName,
                profile.Name,
                profileToSet
                );

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(profile.ResourceGroupName, profile.Name, response));
        }
Example #7
0
        public TrafficManagerProfile[] ListTrafficManagerProfiles(string resourceGroupName = null)
        {
            IEnumerable <Profile> response =
                resourceGroupName == null?
                this.TrafficManagerManagementClient.Profiles.ListBySubscription() :
                    this.TrafficManagerManagementClient.Profiles.ListByResourceGroup(resourceGroupName);

            return(response.Select(profile => TrafficManagerClient.GetPowershellTrafficManagerProfile(
                                       resourceGroupName ?? TrafficManagerClient.ExtractResourceGroupFromId(profile.Id),
                                       profile.Name,
                                       profile)).ToArray());
        }
Example #8
0
        public TrafficManagerProfile[] ListTrafficManagerProfiles(string resourceGroupName = null)
        {
            ProfileListResponse response =
                resourceGroupName == null?
                this.TrafficManagerManagementClient.Profiles.ListAll() :
                    this.TrafficManagerManagementClient.Profiles.ListAllInResourceGroup(resourceGroupName);

            return(response.Profiles.Select(profile => TrafficManagerClient.GetPowershellTrafficManagerProfile(
                                                resourceGroupName ?? TrafficManagerClient.ExtractResourceGroupFromId(profile.Id),
                                                profile.Name,
                                                profile)).ToArray());
        }
Example #9
0
        public TrafficManagerProfile CreateTrafficManagerProfile(
            string resourceGroupName,
            string profileName,
            string profileStatus,
            string trafficRoutingMethod,
            string relativeDnsName,
            uint ttl,
            string monitorProtocol,
            uint monitorPort,
            string monitorPath,
            int?monitorInterval,
            int?monitorTimeout,
            int?monitorToleratedNumberOfFailures,
            long?maxReturn,
            Hashtable tag,
            List <TrafficManagerCustomHeader> customHeaders,
            List <TrafficManagerExpectedStatusCodeRange> expectedStatusCodeRanges)
        {
            Profile response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                resourceGroupName,
                profileName,
                new Profile(name: profileName, location: TrafficManagerClient.ProfileResourceLocation)
            {
                ProfileStatus        = profileStatus,
                TrafficRoutingMethod = trafficRoutingMethod,
                DnsConfig            = new DnsConfig
                {
                    RelativeName = relativeDnsName,
                    Ttl          = ttl
                },
                MonitorConfig = new MonitorConfig
                {
                    Protocol                  = monitorProtocol,
                    Port                      = monitorPort,
                    Path                      = monitorPath,
                    IntervalInSeconds         = monitorInterval,
                    TimeoutInSeconds          = monitorTimeout,
                    ToleratedNumberOfFailures = monitorToleratedNumberOfFailures,
                    CustomHeaders             = customHeaders?.Select(
                        customHeader => customHeader.ToSDKMonitorConfigCustomHeadersItem()).ToList(),
                    ExpectedStatusCodeRanges = expectedStatusCodeRanges?.Select(
                        expectedStatusCodeRange => expectedStatusCodeRange.ToSDKMonitorConfigStatusCodeRangesItem()).ToList(),
                },
                MaxReturn = maxReturn,
                Tags      = TagsConversionHelper.CreateTagDictionary(tag, validate: true),
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(resourceGroupName, profileName, response));
        }
Example #10
0
        public TrafficManagerProfile SetTrafficManagerProfile(TrafficManagerProfile profile)
        {
            var parameters = new ProfileCreateOrUpdateParameters
            {
                Profile = profile.ToSDKProfile()
            };

            ProfileCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                profile.ResourceGroupName,
                profile.Name,
                parameters
                );

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(profile.ResourceGroupName, profile.Name, response.Profile));
        }
Example #11
0
        public TrafficManagerEndpoint SetTrafficManagerEndpoint(TrafficManagerEndpoint endpoint)
        {
            Endpoint endpointToSet = endpoint.ToSDKEndpoint();

            Endpoint response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                endpoint.ResourceGroupName,
                endpoint.ProfileName,
                endpoint.Type,
                endpoint.Name,
                endpointToSet);

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(
                       endpoint.Id,
                       endpoint.ResourceGroupName,
                       endpoint.ProfileName,
                       endpoint.Type,
                       endpoint.Name,
                       response));
        }
Example #12
0
        public TrafficManagerEndpoint CreateTrafficManagerEndpoint(
            string resourceGroupName,
            string profileName,
            string endpointType,
            string endpointName,
            string targetResourceId,
            string target,
            string endpointStatus,
            uint?weight,
            uint?priority,
            string endpointLocation,
            uint?minChildEndpoints,
            uint?minChildEndpointsIPv4,
            uint?minChildEndpointsIPv6,
            IList <string> geoMapping,
            IList <TrafficManagerIpAddressRange> subnetMapping,
            IList <TrafficManagerCustomHeader> customHeaders
            )
        {
            Endpoint response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                resourceGroupName,
                profileName,
                endpointType,
                endpointName,
                new Endpoint(name: endpointName, type: TrafficManagerEndpoint.ToFullEndpointType(endpointType))
            {
                EndpointLocation      = endpointLocation,
                EndpointStatus        = endpointStatus,
                GeoMapping            = geoMapping,
                MinChildEndpoints     = minChildEndpoints,
                MinChildEndpointsIPv4 = minChildEndpointsIPv4,
                MinChildEndpointsIPv6 = minChildEndpointsIPv6,
                Priority         = priority,
                Target           = target,
                TargetResourceId = targetResourceId,
                Weight           = weight,
                Subnets          = subnetMapping?.Select(ipAddressRange => ipAddressRange.ToSDKSubnetMapping()).ToList(),
                CustomHeaders    = customHeaders?.Select(customHeader => customHeader.ToSDKEndpointPropertiesCustomHeadersItem()).ToList()
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(response.Id, resourceGroupName, profileName, endpointType, endpointName, response));
        }
        public TrafficManagerEndpoint CreateTrafficManagerEndpoint(string resourceGroupName, string profileName, string endpointType, string endpointName, string targetResourceId, string target, string endpointStatus, uint?weight, uint?priority, string endpointLocation, uint?minChildEndpoints, IList <string> geoMapping)
        {
            Endpoint response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                resourceGroupName,
                profileName,
                endpointType,
                endpointName,
                new Endpoint(name: endpointName, type: TrafficManagerEndpoint.ToFullEndpointType(endpointType))
            {
                EndpointLocation  = endpointLocation,
                EndpointStatus    = endpointStatus,
                GeoMapping        = geoMapping,
                MinChildEndpoints = minChildEndpoints,
                Priority          = priority,
                Target            = target,
                TargetResourceId  = targetResourceId,
                Weight            = weight,
            });

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(response.Id, resourceGroupName, profileName, endpointType, endpointName, response));
        }
        public TrafficManagerEndpoint SetTrafficManagerEndpoint(TrafficManagerEndpoint endpoint)
        {
            var parameters = new EndpointCreateOrUpdateParameters
            {
                Endpoint = endpoint.ToSDKEndpoint()
            };

            EndpointCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                endpoint.ResourceGroupName,
                endpoint.ProfileName,
                endpoint.Type,
                endpoint.Name,
                parameters);

            return(TrafficManagerClient.GetPowershellTrafficManagerEndpoint(
                       endpoint.ResourceGroupName,
                       endpoint.ProfileName,
                       endpoint.Type,
                       endpoint.Name,
                       response.Endpoint.Properties));
        }
Example #15
0
        public TrafficManagerProfile GetTrafficManagerProfile(string resourceGroupName, string profileName)
        {
            Profile response = this.TrafficManagerManagementClient.Profiles.Get(resourceGroupName, profileName);

            return(TrafficManagerClient.GetPowershellTrafficManagerProfile(resourceGroupName, profileName, response));
        }