protected override void ProcessRecord() { TrafficManagerProfile profile = this.TrafficManagerClient.SetTrafficManagerProfile(this.TrafficManagerProfile); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); }
private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, ProfileProperties mamlProfileProperties) { var profile = new TrafficManagerProfile { Name = profileName, ResourceGroupName = resourceGroupName, RelativeDnsName = mamlProfileProperties.DnsConfig.RelativeName, Ttl = mamlProfileProperties.DnsConfig.Ttl, TrafficRoutingMethod = mamlProfileProperties.TrafficRoutingMethod, MonitorProtocol = mamlProfileProperties.MonitorConfig.Protocol, MonitorPort = mamlProfileProperties.MonitorConfig.Port, MonitorPath = mamlProfileProperties.MonitorConfig.Path }; if (mamlProfileProperties.Endpoints != null) { profile.Endpoints = new List <Models.Endpoint>(); foreach (Endpoint endpoint in mamlProfileProperties.Endpoints) { profile.Endpoints.Add(new Models.Endpoint { Name = endpoint.Name, Type = endpoint.Type, Target = endpoint.Properties.Target, EndpointStatus = endpoint.Properties.EndpointStatus, Location = endpoint.Properties.EndpointLocation, Priority = endpoint.Properties.Priority, Weight = endpoint.Properties.Weight }); } } return(profile); }
public override void ExecuteCmdlet() { TrafficManagerProfile profile = this.TrafficManagerClient.SetTrafficManagerProfile(this.TrafficManagerProfile); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); }
public override void ExecuteCmdlet() { // We are not supporting etags yet, NewAzureTrafficManagerProfile should not overwrite any existing profile. // Since our create operation is implemented using PUT, it will overwrite by default. // Therefore, we need to check whether the Profile exists before we actually try to create it. try { this.TrafficManagerClient.GetTrafficManagerProfile(this.ResourceGroupName, this.Name); throw new PSArgumentException(string.Format(ProjectResources.Error_CreateExistingProfile, this.Name, this.ResourceGroupName)); } catch (CloudException exception) { if (exception.Response.StatusCode.Equals(HttpStatusCode.NotFound)) { TrafficManagerProfile profile = this.TrafficManagerClient.CreateTrafficManagerProfile( this.ResourceGroupName, this.Name, this.TrafficRoutingMethod, this.RelativeDnsName, this.Ttl, this.MonitorProtocol, this.MonitorPort, this.MonitorPath); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); } else { throw; } } }
public override void ExecuteCmdlet() { TrafficManagerProfile profileToEnable = null; if (this.ParameterSetName == "Fields") { profileToEnable = new TrafficManagerProfile { Name = this.Name, ResourceGroupName = this.ResourceGroupName }; } else if (this.ParameterSetName == "Object") { profileToEnable = this.TrafficManagerProfile; } bool enabled = this.TrafficManagerClient.EnableDisableTrafficManagerProfile(profileToEnable, shouldEnableProfileStatus: true); if (enabled) { this.WriteVerbose(ProjectResources.Success); this.WriteVerbose(string.Format(ProjectResources.Success_EnableProfile, profileToEnable.Name, profileToEnable.ResourceGroupName)); } this.WriteObject(enabled); }
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( GetPowershellTrafficManagerEndpoint( endpoint.Id, resourceGroupName, profileName, endpoint.Type, endpoint.Name, endpoint.Properties)); } } return(profile); }
protected override void ProcessRecord() { var disabled = false; TrafficManagerProfile profileToDisable = null; if (this.ParameterSetName == "Fields") { profileToDisable = new TrafficManagerProfile { Name = this.Name, ResourceGroupName = this.ResourceGroupName }; } else if (this.ParameterSetName == "Object") { profileToDisable = this.TrafficManagerProfile; } this.ConfirmAction( this.Force.IsPresent, string.Format(ProjectResources.Confirm_DisableProfile, profileToDisable.Name), ProjectResources.Progress_DisablingProfile, profileToDisable.Name, () => { disabled = this.TrafficManagerClient.EnableDisableTrafficManagerProfile(profileToDisable, shouldEnableProfileStatus: false); }); if (disabled) { this.WriteVerbose(ProjectResources.Success); this.WriteVerbose(string.Format(ProjectResources.Success_DisableProfile, profileToDisable.Name, profileToDisable.ResourceGroupName)); } this.WriteObject(disabled); }
public override void ExecuteCmdlet() { ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); if (string.IsNullOrEmpty(Name)) { this.Name = profile.Name; } if (!profile.Name.Equals(Name)) { throw new Exception(Resources.SetTrafficManagerProfileAmbiguous); } DefinitionCreateParameters updatedDefinitionAsParam = TrafficManagerClient.InstantiateTrafficManagerDefinition( LoadBalancingMethod ?? profile.LoadBalancingMethod.ToString(), MonitorPort.HasValue ? MonitorPort.Value : profile.MonitorPort, MonitorProtocol ?? profile.MonitorProtocol.ToString(), MonitorRelativePath ?? profile.MonitorRelativePath, Ttl.HasValue ? Ttl.Value : profile.TimeToLiveInSeconds, profile.Endpoints); ProfileWithDefinition newDefinition = TrafficManagerClient.AssignDefinitionToProfile(Name, updatedDefinitionAsParam); WriteObject(newDefinition); }
public override void ExecuteCmdlet() { var deleted = false; TrafficManagerProfile profileToDelete = null; if (this.ParameterSetName == "Fields") { profileToDelete = new TrafficManagerProfile { Name = this.Name, ResourceGroupName = this.ResourceGroupName }; } else if (this.ParameterSetName == "Object") { profileToDelete = this.TrafficManagerProfile; } this.ConfirmAction( this.Force.IsPresent, string.Format(ProjectResources.Confirm_RemoveProfile, profileToDelete.Name), ProjectResources.Progress_RemovingProfile, this.Name, () => { deleted = this.TrafficManagerClient.DeleteTrafficManagerProfile(profileToDelete); }); if (deleted) { this.WriteVerbose(ProjectResources.Success); this.WriteVerbose(string.Format(ProjectResources.Success_RemoveProfile, profileToDelete.Name, profileToDelete.ResourceGroupName)); } this.WriteObject(deleted); }
public bool DeleteTrafficManagerProfile(TrafficManagerProfile profile) { // DeleteOperationResult response = HttpStatusCode code = this.DeleteTrafficManagerProfile(profile.ResourceGroupName, profile.Name); return(code == HttpStatusCode.OK); }
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)); }
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)); }
public bool EnableDisableTrafficManagerProfile(TrafficManagerProfile profile, bool shouldEnableProfileStatus) { profile.ProfileStatus = shouldEnableProfileStatus ? Constants.StatusEnabled : Constants.StatusDisabled; Profile sdkProfile = profile.ToSDKProfile(); sdkProfile.DnsConfig = null; sdkProfile.Endpoints = null; sdkProfile.TrafficRoutingMethod = null; sdkProfile.MonitorConfig = null; Profile response = this.TrafficManagerManagementClient.Profiles.Update(profile.ResourceGroupName, profile.Name, sdkProfile); return(true); }
public override void ExecuteCmdlet() { ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); if (!profile.Endpoints.Any(e => e.DomainName.Equals(DomainName, StringComparison.InvariantCultureIgnoreCase))) { throw new Exception(Resources.RemoveTrafficManagerEndpointMissing); } TrafficManagerEndpoint endpoint = profile.Endpoints.First(e => e.DomainName.Equals(DomainName, StringComparison.InvariantCultureIgnoreCase)); profile.Endpoints.Remove(endpoint); WriteObject(profile); }
public override void ExecuteCmdlet() { ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); if (!profile.Endpoints.Any(e => e.DomainName == DomainName)) { throw new Exception(Resources.RemoveTrafficManagerEndpointMissing); } TrafficManagerEndpoint endpoint = profile.Endpoints.First(e => e.DomainName == DomainName); profile.Endpoints.Remove(endpoint); WriteObject(profile); }
public override void ExecuteCmdlet() { if (this.ResourceGroupName != null && this.Name != null) { TrafficManagerProfile profile = this.TrafficManagerClient.GetTrafficManagerProfile(this.ResourceGroupName, this.Name); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); } else { TrafficManagerProfile[] profiles = this.TrafficManagerClient.ListTrafficManagerProfiles(this.ResourceGroupName); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profiles, enumerateCollection: true); } }
private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, Profile sdkProfile) { var profile = new TrafficManagerProfile { Id = sdkProfile.Id, Tags = TagsConversionHelper.CreateTagHashtable(sdkProfile.Tags), Name = profileName, ResourceGroupName = resourceGroupName, ProfileStatus = sdkProfile.ProfileStatus, RelativeDnsName = sdkProfile.DnsConfig.RelativeName, Ttl = (uint)sdkProfile.DnsConfig.Ttl, TrafficRoutingMethod = sdkProfile.TrafficRoutingMethod, MonitorProtocol = sdkProfile.MonitorConfig.Protocol, MonitorPort = (uint)sdkProfile.MonitorConfig.Port, MonitorPath = sdkProfile.MonitorConfig.Path, MonitorIntervalInSeconds = (int?)sdkProfile.MonitorConfig.IntervalInSeconds, MonitorTimeoutInSeconds = (int?)sdkProfile.MonitorConfig.TimeoutInSeconds, MonitorToleratedNumberOfFailures = (int?)sdkProfile.MonitorConfig.ToleratedNumberOfFailures, MaxReturn = sdkProfile.MaxReturn, CustomHeaders = sdkProfile.MonitorConfig.CustomHeaders?.Select( customHeader => TrafficManagerCustomHeader.FromSDKMonitorConfigCustomHeadersItem(customHeader)).ToList(), ExpectedStatusCodeRanges = sdkProfile.MonitorConfig.ExpectedStatusCodeRanges?.Select( statusCodeRanges => TrafficManagerExpectedStatusCodeRange.FromSDKMonitorConfigStatusCodeRangesItem(statusCodeRanges)) .Where(statusCodeRange => statusCodeRange != null).ToList(), }; if (sdkProfile.Endpoints != null) { profile.Endpoints = new List <TrafficManagerEndpoint>(); foreach (Endpoint endpoint in sdkProfile.Endpoints) { profile.Endpoints.Add( GetPowershellTrafficManagerEndpoint( endpoint.Id, resourceGroupName, profileName, endpoint.Type, endpoint.Name, endpoint)); } } return(profile); }
public override void ExecuteCmdlet() { ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); TrafficManagerEndpoint endpoint = profile.Endpoints.FirstOrDefault(e => e.DomainName.Equals(DomainName, StringComparison.InvariantCultureIgnoreCase)); if (endpoint == null) { if (String.IsNullOrEmpty(Type) || String.IsNullOrEmpty(Status) || String.IsNullOrEmpty(DomainName)) { throw new Exception(Resources.SetTrafficManagerEndpointNeedsParameters); } WriteVerboseWithTimestamp(Resources.SetInexistentTrafficManagerEndpointMessage, profile.Name, DomainName); endpoint = new TrafficManagerEndpoint(); endpoint.DomainName = DomainName; endpoint.Location = Location; endpoint.Type = (EndpointType)Enum.Parse(typeof(EndpointType), Type); endpoint.Weight = Weight; endpoint.MinChildEndpoints = MinChildEndpoints; endpoint.Status = (EndpointStatus)Enum.Parse(typeof(EndpointStatus), Status); // Add it because the endpoint didn't exist profile.Endpoints.Add(endpoint); } endpoint.Location = Location ?? endpoint.Location; endpoint.Type = !String.IsNullOrEmpty(Type) ? (EndpointType)Enum.Parse(typeof(EndpointType), Type) : endpoint.Type; endpoint.Weight = Weight.HasValue ? Weight.Value : endpoint.Weight; endpoint.MinChildEndpoints = MinChildEndpoints.HasValue ? MinChildEndpoints.Value : endpoint.MinChildEndpoints; endpoint.Status = !String.IsNullOrEmpty(Status) ? (EndpointStatus)Enum.Parse(typeof(EndpointStatus), Status) : endpoint.Status; WriteObject(profile); }
public bool EnableDisableTrafficManagerProfile(TrafficManagerProfile profile, bool shouldEnableProfileStatus) { profile.ProfileStatus = shouldEnableProfileStatus ? Constants.StatusEnabled : Constants.StatusDisabled; Profile sdkProfile = profile.ToSDKProfile(); sdkProfile.Properties.DnsConfig = null; sdkProfile.Properties.Endpoints = null; sdkProfile.Properties.TrafficRoutingMethod = null; sdkProfile.Properties.MonitorConfig = null; var parameters = new ProfileUpdateParameters { Profile = sdkProfile }; AzureOperationResponse response = this.TrafficManagerManagementClient.Profiles.Update(profile.ResourceGroupName, profile.Name, parameters); return(response.StatusCode.Equals(HttpStatusCode.OK)); }
public override void ExecuteCmdlet() { TrafficManagerEndpoint endpoint = new TrafficManagerEndpoint(); endpoint.DomainName = DomainName; endpoint.Location = Location; endpoint.Status = (EndpointStatus)Enum.Parse(typeof(EndpointStatus), Status); endpoint.Type = (EndpointType)Enum.Parse(typeof(EndpointType), Type); endpoint.Weight = Weight.HasValue ? Weight.Value : 1; ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); if (profile.Endpoints.Any(e => e.DomainName == endpoint.DomainName)) { throw new Exception( string.Format(Resources.AddTrafficManagerEndpointFailed, profile.Name, endpoint.DomainName)); } profile.Endpoints.Add(endpoint); WriteObject(TrafficManagerProfile); }
protected override void ProcessRecord() { if (this.ResourceGroupName == null && this.Name != null) { // Throw an error } else if (this.ResourceGroupName != null && this.Name != null) { TrafficManagerProfile profile = this.TrafficManagerClient.GetTrafficManagerProfile(this.ResourceGroupName, this.Name); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); } else { TrafficManagerProfile[] profiles = this.TrafficManagerClient.ListTrafficManagerProfiles(this.ResourceGroupName); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profiles); } }
public override void ExecuteCmdlet() { TrafficManagerEndpoint endpoint = new TrafficManagerEndpoint(); endpoint.DomainName = DomainName; endpoint.Location = Location; endpoint.Status = (EndpointStatus)Enum.Parse(typeof(EndpointStatus), Status); endpoint.Type = (EndpointType)Enum.Parse(typeof(EndpointType), Type); endpoint.Weight = Weight; endpoint.MinChildEndpoints = MinChildEndpoints; ProfileWithDefinition profile = TrafficManagerProfile.GetInstance(); if (profile.Endpoints.Any(e => e.DomainName.Equals(endpoint.DomainName, StringComparison.InvariantCultureIgnoreCase))) { throw new Exception( string.Format(Resources.AddTrafficManagerEndpointFailed, profile.Name, endpoint.DomainName)); } profile.Endpoints.Add(endpoint); WriteObject(TrafficManagerProfile); }
public override void ExecuteCmdlet() { // We are not supporting etags yet, NewAzureTrafficManagerProfile should not overwrite any existing profile. // Since our create operation is implemented using PUT, it will overwrite by default. // Therefore, we need to check whether the Profile exists before we actually try to create it. try { WriteWarning("The usage of Tag parameter in this cmdlet will be modified in a future release. This will impact creating, updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494"); this.TrafficManagerClient.GetTrafficManagerProfile(this.ResourceGroupName, this.Name); throw new PSArgumentException(string.Format(ProjectResources.Error_CreateExistingProfile, this.Name, this.ResourceGroupName)); } catch (CloudException exception) { if (exception.Response.StatusCode.Equals(HttpStatusCode.NotFound)) { TrafficManagerProfile profile = this.TrafficManagerClient.CreateTrafficManagerProfile( this.ResourceGroupName, this.Name, this.ProfileStatus, this.TrafficRoutingMethod, this.RelativeDnsName, this.Ttl, this.MonitorProtocol, this.MonitorPort, this.MonitorPath, this.Tag); this.WriteVerbose(ProjectResources.Success); this.WriteObject(profile); } else { throw; } } }
private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, Profile sdkProfile) { var profile = new TrafficManagerProfile { Id = sdkProfile.Id, Name = profileName, ResourceGroupName = resourceGroupName, ProfileStatus = sdkProfile.ProfileStatus, RelativeDnsName = sdkProfile.DnsConfig.RelativeName, Ttl = (uint)sdkProfile.DnsConfig.Ttl, TrafficRoutingMethod = sdkProfile.TrafficRoutingMethod, MonitorProtocol = sdkProfile.MonitorConfig.Protocol, MonitorPort = (uint)sdkProfile.MonitorConfig.Port, MonitorPath = sdkProfile.MonitorConfig.Path, MonitorIntervalInSeconds = (int?)sdkProfile.MonitorConfig.IntervalInSeconds, MonitorTimeoutInSeconds = (int?)sdkProfile.MonitorConfig.TimeoutInSeconds, MonitorToleratedNumberOfFailures = (int?)sdkProfile.MonitorConfig.ToleratedNumberOfFailures, }; if (sdkProfile.Endpoints != null) { profile.Endpoints = new List <TrafficManagerEndpoint>(); foreach (Endpoint endpoint in sdkProfile.Endpoints) { profile.Endpoints.Add( GetPowershellTrafficManagerEndpoint( endpoint.Id, resourceGroupName, profileName, endpoint.Type, endpoint.Name, endpoint)); } } return(profile); }
public bool EnableDisableTrafficManagerProfile(TrafficManagerProfile profile, bool shouldEnableProfileStatus) { profile.ProfileStatus = shouldEnableProfileStatus ? Constants.StatusEnabled : Constants.StatusDisabled; Profile sdkProfile = profile.ToSDKProfile(); sdkProfile.Properties.DnsConfig = null; sdkProfile.Properties.Endpoints = null; sdkProfile.Properties.TrafficRoutingMethod = null; sdkProfile.Properties.MonitorConfig = null; var parameters = new ProfileUpdateParameters { Profile = sdkProfile }; AzureOperationResponse response = this.TrafficManagerManagementClient.Profiles.Update(profile.ResourceGroupName, profile.Name, parameters); return response.StatusCode.Equals(HttpStatusCode.OK); }
public bool DeleteTrafficManagerProfile(TrafficManagerProfile profile) { AzureOperationResponse response = this.TrafficManagerManagementClient.Profiles.Delete(profile.ResourceGroupName, profile.Name); return(response.StatusCode.Equals(HttpStatusCode.OK)); }
public Task CreateTrafficManagerProfileAsync(TrafficManagerProfile profile) { return(profile.CreateAsync(this)); }
public TrafficManagerTests() { Debug.WriteLine("Creating traffic manager profile"); Profile = new TrafficManagerProfile("Test-" + Guid.NewGuid().ToString("N"), Parent.CloudService.Name + ".trafficmanager.net"); Subscription.CreateTrafficManagerProfileAsync(Profile).Wait(); }
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); }
public CosmosApp(string name, CosmosAppArgs args, ComponentResourceOptions?options = null) : base("examples:azure:CosmosApp", name, options) { var resourceGroup = args.ResourceGroup; var locations = args.Locations; var primaryLocation = locations[0]; var parentOptions = new CustomResourceOptions { Parent = this }; // Cosmos DB Account with multiple replicas var cosmosAccount = new Account($"cosmos-{name}", new AccountArgs { ResourceGroupName = resourceGroup.Name, Location = primaryLocation, GeoLocations = locations.Select((l, i) => new AccountGeoLocationArgs { Location = l, FailoverPriority = i }).ToArray(), OfferType = "Standard", ConsistencyPolicy = new AccountConsistencyPolicyArgs { ConsistencyLevel = "Session" }, EnableMultipleWriteLocations = args.EnableMultiMaster, }, parentOptions); var database = new SqlDatabase($"db-{name}", new SqlDatabaseArgs { ResourceGroupName = resourceGroup.Name, AccountName = cosmosAccount.Name, Name = args.DatabaseName, }, parentOptions); var container = new SqlContainer($"sql-{name}", new SqlContainerArgs { ResourceGroupName = resourceGroup.Name, AccountName = cosmosAccount.Name, DatabaseName = database.Name, Name = args.ContainerName, }, parentOptions); // Traffic Manager as a global HTTP endpoint var profile = new TrafficManagerProfile($"tm{name}", new TrafficManagerProfileArgs { ResourceGroupName = resourceGroup.Name, TrafficRoutingMethod = "Performance", DnsConfig = new TrafficManagerProfileDnsConfigArgs { // Subdomain must be globally unique, so we default it with the full resource group name RelativeName = Output.Format($"{name}{resourceGroup.Name}"), Ttl = 60, }, MonitorConfig = new TrafficManagerProfileMonitorConfigArgs { Protocol = "HTTP", Port = 80, Path = "/api/ping", } }, parentOptions); var globalContext = new GlobalContext(resourceGroup, cosmosAccount, database, container, parentOptions); var buildLocation = args.Factory(globalContext); var endpointOptions = new CustomResourceOptions { Parent = profile, DeleteBeforeReplace = true }; var endpoints = locations.Select(location => { var app = buildLocation(new RegionalContext(location)); return(new TrafficManagerEndpoint($"tm{name}{location}".Truncate(16), new TrafficManagerEndpointArgs { ResourceGroupName = resourceGroup.Name, ProfileName = profile.Name, Type = app.Type, TargetResourceId = app.Id, Target = app.Url, EndpointLocation = location, }, endpointOptions)); }).ToList(); this.Endpoint = Output.Format($"http://{profile.Fqdn}"); this.RegisterOutputs(); }
public bool DeleteTrafficManagerProfile(TrafficManagerProfile profile) { AzureOperationResponse response = this.TrafficManagerManagementClient.Profiles.Delete(profile.ResourceGroupName, profile.Name); return response.StatusCode.Equals(HttpStatusCode.OK); }
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; }