Beispiel #1
0
        internal ProfileCollection(ArmResource parent) : base(parent)
        {
            _clientDiagnostics  = new ClientDiagnostics(ClientOptions);
            _profilesRestClient = new ProfilesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
#if DEBUG
            ValidateResourceId(Id);
#endif
        }
        internal ProfileCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
        {
            _profileClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Cdn", Profile.ResourceType.Namespace, DiagnosticOptions);
            TryGetApiVersion(Profile.ResourceType, out string profileApiVersion);
            _profileRestClient = new ProfilesRestOperations(Pipeline, DiagnosticOptions.ApplicationId, BaseUri, profileApiVersion);
#if DEBUG
            ValidateResourceId(Id);
#endif
        }
        internal ProfileCollection(ArmResource parent) : base(parent)
        {
            _clientDiagnostics = new ClientDiagnostics(ClientOptions);
            ClientOptions.TryGetApiVersion(Profile.ResourceType, out string apiVersion);
            _profilesRestClient = new ProfilesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion);
#if DEBUG
            ValidateResourceId(Id);
#endif
        }
Beispiel #4
0
 public static Pageable <Profile> GetProfiles(this Subscription subscription, CancellationToken cancellationToken = default)
 {
     return(subscription.UseClientContext((baseUri, credential, options, pipeline) =>
     {
         var clientDiagnostics = new ClientDiagnostics(options);
         options.TryGetApiVersion(Profile.ResourceType, out string apiVersion);
         ProfilesRestOperations restOperations = GetProfilesRestOperations(clientDiagnostics, pipeline, options, baseUri, apiVersion);
         Page <Profile> FirstPageFunc(int?pageSizeHint)
         {
             using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetProfiles");
             scope.Start();
             try
             {
                 var response = restOperations.List(subscription.Id.SubscriptionId, cancellationToken: cancellationToken);
                 return Page.FromValues(response.Value.Value.Select(value => new Profile(subscription, value)), response.Value.NextLink, response.GetRawResponse());
             }
             catch (Exception e)
             {
                 scope.Failed(e);
                 throw;
             }
         }
         Page <Profile> NextPageFunc(string nextLink, int?pageSizeHint)
         {
             using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetProfiles");
             scope.Start();
             try
             {
                 var response = restOperations.ListNextPage(nextLink, subscription.Id.SubscriptionId, cancellationToken: cancellationToken);
                 return Page.FromValues(response.Value.Value.Select(value => new Profile(subscription, value)), response.Value.NextLink, response.GetRawResponse());
             }
             catch (Exception e)
             {
                 scope.Failed(e);
                 throw;
             }
         }
         return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
     }
                                          ));
 }