Exemplo n.º 1
0
 /// <summary>
 /// Specifies the geographic location for the endpoint that will be used when the parent profile is configured
 /// with Geographic based routing method  TrafficRoutingMethod.GEOGRAPHIC.
 /// </summary>
 /// <param name="geographicLocation">The geographic location.</param>
 /// <return>The next stage of the update.</return>
 Microsoft.Azure.Management.TrafficManager.Fluent.TrafficManagerEndpoint.Update.IUpdate Microsoft.Azure.Management.TrafficManager.Fluent.TrafficManagerEndpoint.Update.IWithGeographicLocation.WithGeographicLocation(IGeographicLocation geographicLocation)
 {
     return(this.WithGeographicLocation(geographicLocation));
 }
 ///GENMHASH:6B5F84A9B6F2D8700DA3A5F71E5000F8:FB9D4C73535F411169B12EACB830D877
 public TrafficManagerEndpointImpl WithoutGeographicLocation(IGeographicLocation geographicLocation)
 {
     return(this.WithoutGeographicLocation(geographicLocation.Code));
 }
        public void CanCreateUpdateProfileWithGeographicEndpoint()
        {
            using (var context = FluentMockContext.Start(GetType().FullName))
            {
                var region = Region.USEast;

                var groupName         = TestUtilities.GenerateName("rgchashtm");
                var tmProfileName     = TestUtilities.GenerateName("tm");
                var tmProfileDnsLabel = TestUtilities.GenerateName("tmdns");

                var azure = TestHelper.CreateRollupClient();

                try
                {
                    var geographicLocation = azure.TrafficManagerProfiles.GetGeographicHierarchyRoot();

                    IGeographicLocation california = geographicLocation.DescendantLocations.FirstOrDefault(l => l.Name.Equals("California", StringComparison.OrdinalIgnoreCase));
                    IGeographicLocation bangladesh = geographicLocation.DescendantLocations.FirstOrDefault(l => l.Name.Equals("Bangladesh", StringComparison.OrdinalIgnoreCase));

                    Assert.NotNull(california);
                    Assert.NotNull(bangladesh);

                    var profile = azure.TrafficManagerProfiles.Define(tmProfileName)
                                  .WithNewResourceGroup(groupName, region)
                                  .WithLeafDomainLabel(tmProfileDnsLabel)
                                  .WithGeographicBasedRouting()
                                  .DefineExternalTargetEndpoint("external-ep-1")
                                  .ToFqdn("www.gitbook.com")
                                  .FromRegion(Region.AsiaEast)
                                  .WithGeographicLocation(california)
                                  .WithGeographicLocation(bangladesh)
                                  .Attach()
                                  .WithHttpsMonitoring()
                                  .WithTimeToLive(500)
                                  .Create();

                    Assert.NotNull(profile.Inner);
                    Assert.True(profile.TrafficRoutingMethod.Equals(TrafficRoutingMethod.Geographic));
                    Assert.True(profile.ExternalEndpoints.ContainsKey("external-ep-1"));
                    var endpoint = profile.ExternalEndpoints["external-ep-1"];
                    Assert.NotNull(endpoint.GeographicLocationCodes);
                    Assert.Equal(2, endpoint.GeographicLocationCodes.Count());

                    profile.Update()
                    .UpdateExternalTargetEndpoint("external-ep-1")
                    .WithoutGeographicLocation(california)
                    .Parent()
                    .Apply();

                    Assert.True(profile.TrafficRoutingMethod.Equals(TrafficRoutingMethod.Geographic));
                    Assert.True(profile.ExternalEndpoints.ContainsKey("external-ep-1"));
                    endpoint = profile.ExternalEndpoints["external-ep-1"];
                    Assert.NotNull(endpoint.GeographicLocationCodes);
                    Assert.Single(endpoint.GeographicLocationCodes);
                }
                finally
                {
                    try
                    {
                        azure.ResourceGroups.BeginDeleteByName(groupName);
                    }
                    catch { }
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Specifies the geographic location for the endpoint that will be used when the parent profile is configured
 /// with Geographic based routing method  TrafficRoutingMethod.GEOGRAPHIC.
 /// </summary>
 /// <param name="geographicLocation">The geographic location.</param>
 /// <return>The next stage of the definition.</return>
 Microsoft.Azure.Management.TrafficManager.Fluent.TrafficManagerEndpoint.UpdateDefinition.IWithAttach <TrafficManagerProfile.Update.IUpdate> Microsoft.Azure.Management.TrafficManager.Fluent.TrafficManagerEndpoint.UpdateDefinition.IWithGeographicLocationBeta <TrafficManagerProfile.Update.IUpdate> .WithGeographicLocation(IGeographicLocation geographicLocation)
 {
     return(this.WithGeographicLocation(geographicLocation) as TrafficManagerEndpoint.UpdateDefinition.IWithAttach <TrafficManagerProfile.Update.IUpdate>);
 }
 /// <summary>
 /// Serialization constructor used for deserialization
 /// </summary>
 /// <param name="info">The serialization info</param>
 /// <param name="context">The context of the stream</param>
 public SpaceTimeInformation(SerializationInfo info, StreamingContext context)
 {
     PhysicalLocation = (IGeographicLocation)info.GetValue("PhysicalLocation", typeof(IGeographicLocation));
     PointInTime      = info.GetDateTime("PointInTime");
 }
 /// <summary> 
 /// Initializes a new instance of the <see cref="SpaceTimeInformation">SpaceTimeInformation</see> class. 
 /// <param name="location">The specific location that is occupied at this moment</param>
 /// <param name="pointInTime">A specific time that this location refers to</param>
 /// </summary>
 public SpaceTimeInformation(GeographicLocation location, DateTime pointInTime)
 {
     PhysicalLocation = location;
     PointInTime      = pointInTime;
 }
 /// <summary> 
 /// Initializes a new instance of the <see cref="SpaceTimeInformation">SpaceTimeInformation</see> class. 
 /// <param name="pointInTime">A specific time that this location refers to</param>
 /// </summary>
 public SpaceTimeInformation(DateTime pointInTime)
 {
     PhysicalLocation = new GeographicLocation();
     PointInTime      = pointInTime;
 }
 /// <summary> 
 /// Initializes a new instance of the <see cref="SpaceTimeInformation">SpaceTimeInformation</see> class. 
 /// <param name="location">The specific location that is occupied at this moment</param>
 /// </summary>
 public SpaceTimeInformation(GeographicLocation location)
 {
     PhysicalLocation = location;
     PointInTime      = new DateTimeProvider().UtcNow;
 }