Exemple #1
0
        public virtual CdnOriginGroupUpdateOperation Update(bool waitForCompletion, OriginGroupUpdateOptions originGroupUpdateProperties, CancellationToken cancellationToken = default)
        {
            if (originGroupUpdateProperties == null)
            {
                throw new ArgumentNullException(nameof(originGroupUpdateProperties));
            }

            using var scope = _clientDiagnostics.CreateScope("CdnOriginGroup.Update");
            scope.Start();
            try
            {
                var response  = _cdnOriginGroupsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originGroupUpdateProperties, cancellationToken);
                var operation = new CdnOriginGroupUpdateOperation(this, _clientDiagnostics, Pipeline, _cdnOriginGroupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, originGroupUpdateProperties).Request, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
        public async Task UpdateOriginGroups()
        {
            #region Snippet:Managing_OriginGroups_UpdateAnOriginGroup
            // First we need to get the cdn origin group collection from the specific endpoint
            Profile profile = await resourceGroup.GetProfiles().GetAsync("myProfile");

            CdnEndpoint endpoint = await profile.GetCdnEndpoints().GetAsync("myEndpoint");

            CdnOriginGroupCollection originGroupCollection = endpoint.GetCdnOriginGroups();
            // Now we can get the origin group with GetAsync()
            CdnOriginGroup originGroup = await originGroupCollection.GetAsync("myOriginGroup");

            // With UpdateAsync(), we can update the origin group
            OriginGroupUpdateOptions input = new OriginGroupUpdateOptions()
            {
                HealthProbeSettings = new HealthProbeParameters
                {
                    ProbePath              = "/healthz",
                    ProbeRequestType       = HealthProbeRequestType.Head,
                    ProbeProtocol          = ProbeProtocol.Https,
                    ProbeIntervalInSeconds = 60
                }
            };
            CdnOriginGroupUpdateOperation lro = await originGroup.UpdateAsync(input);

            originGroup = lro.Value;
            #endregion Snippet:Managing_OriginGroups_UpdateAnOriginGroup
        }