public void SetOriginGroup() { OriginGroupUpdateParameters originGroup = new OriginGroupUpdateParameters(); if (ParameterSetName == ObjectParameterSet) { originGroup.Origins = CdnOriginGroup.Origins; } else { originGroup.Origins = new List <ResourceReference>(); // OriginId refers to the list of origin ids, needed to be singular name per PS guidelines foreach (string originId in OriginId) { ResourceReference originIdResourceReference = new ResourceReference(originId); originGroup.Origins.Add(originIdResourceReference); } } bool isProbeIntervalInSecondsNotZero = ProbeIntervalInSeconds != 0 ? true : false; if (isProbeIntervalInSecondsNotZero || !String.IsNullOrWhiteSpace(ProbePath) || !String.IsNullOrWhiteSpace(ProbeProtocol) || !String.IsNullOrWhiteSpace(ProbeRequestType)) { int probeIntervalCopy = ProbeIntervalInSeconds; // when probe interval is 0 or not specified, set the probe interval to the default value if (!isProbeIntervalInSecondsNotZero) { probeIntervalCopy = 240; } originGroup.HealthProbeSettings = new HealthProbeParameters { ProbeIntervalInSeconds = probeIntervalCopy, ProbePath = ProbePath, ProbeProtocol = OriginGroupUtilities.NormalizeProbeProtocol(ProbeProtocol), ProbeRequestType = OriginGroupUtilities.NormalizeProbeRequestType(ProbeRequestType) }; } try { var updatedOriginGroup = CdnManagementClient.OriginGroups.Update( ResourceGroupName, ProfileName, EndpointName, OriginGroupName, originGroup); WriteVerbose(Resources.Success); WriteObject(updatedOriginGroup.ToPsOriginGroup()); } catch (ErrorResponseException e) { throw new PSArgumentException(string.Format("Error response received.Error Message: '{0}'", e.Response.Content)); } }
/// <summary> /// Updates an existing origin group within an endpoint. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of the Resource group within the Azure subscription. /// </param> /// <param name='profileName'> /// Name of the CDN profile which is unique within the resource group. /// </param> /// <param name='endpointName'> /// Name of the endpoint under the profile which is unique globally. /// </param> /// <param name='originGroupName'> /// Name of the origin group which is unique within the endpoint. /// </param> /// <param name='originGroupUpdateProperties'> /// Origin group properties /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <OriginGroup> BeginUpdateAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Updates an existing origin group within an endpoint. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of the Resource group within the Azure subscription. /// </param> /// <param name='profileName'> /// Name of the CDN profile which is unique within the resource group. /// </param> /// <param name='endpointName'> /// Name of the endpoint under the profile which is unique globally. /// </param> /// <param name='originGroupName'> /// Name of the origin group which is unique within the endpoint. /// </param> /// <param name='originGroupUpdateProperties'> /// Origin group properties /// </param> public static OriginGroup BeginUpdate(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties) { return(operations.BeginUpdateAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties).GetAwaiter().GetResult()); }