Пример #1
0
 public virtual Response <IReadOnlyList <VirtualMachineScaleSetVMExtension> > GetAll(string expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetVMExtensionCollection.GetAll");
     scope.Start();
     try
     {
         var response = _virtualMachineScaleSetVMExtensionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken);
         return(Response.FromValue(response.Value.Value.Select(value => new VirtualMachineScaleSetVMExtension(Parent, value)).ToArray() as IReadOnlyList <VirtualMachineScaleSetVMExtension>, response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Пример #2
0
        public virtual Pageable <VirtualMachineScaleSetVmExtension> GetAll(string expand = null, CancellationToken cancellationToken = default)
        {
            Page <VirtualMachineScaleSetVmExtension> FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtensionCollection.GetAll");
                scope.Start();
                try
                {
                    var response = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value.Select(value => new VirtualMachineScaleSetVmExtension(Client, value)), null, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            return(PageableHelpers.CreateEnumerable(FirstPageFunc, null));
        }