public virtual Response <TenantPolicyDefinition> Get(string policyDefinitionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); using var scope = _tenantPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("TenantPolicyDefinitionCollection.Get"); scope.Start(); try { var response = _tenantPolicyDefinitionPolicyDefinitionsRestClient.GetBuiltIn(policyDefinitionName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new TenantPolicyDefinition(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response<TenantPolicyDefinition> Get(CancellationToken cancellationToken = default) { using var scope = _tenantPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("TenantPolicyDefinition.Get"); scope.Start(); try { var response = _tenantPolicyDefinitionPolicyDefinitionsRestClient.GetBuiltIn(Id.Name, cancellationToken); if (response.Value == null) throw _tenantPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new TenantPolicyDefinition(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } }