Esempio n. 1
0
 public virtual Response <DdosProtectionPlan> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("DdosProtectionPlan.Get");
     scope.Start();
     try
     {
         var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new DdosProtectionPlan(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Esempio n. 2
0
        public virtual Response <DdosProtectionPlan> Get(string ddosProtectionPlanName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(ddosProtectionPlanName, nameof(ddosProtectionPlanName));

            using var scope = _ddosProtectionPlanClientDiagnostics.CreateScope("DdosProtectionPlanCollection.Get");
            scope.Start();
            try
            {
                var response = _ddosProtectionPlanRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ddosProtectionPlanName, cancellationToken);
                if (response.Value == null)
                {
                    throw _ddosProtectionPlanClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DdosProtectionPlan(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 3
0
        public virtual Response <DdosProtectionPlan> Get(string ddosProtectionPlanName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("DdosProtectionPlanCollection.Get");
            scope.Start();
            try
            {
                if (ddosProtectionPlanName == null)
                {
                    throw new ArgumentNullException(nameof(ddosProtectionPlanName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, ddosProtectionPlanName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DdosProtectionPlan(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }