Пример #1
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedList()
 {
     // Snippet: AggregatedList(string, CallSettings)
     // Create client
     DisksClient disksClient = DisksClient.Create();
     // Initialize request argument(s)
     string project = "";
     // Make the request
     DiskAggregatedList response = disksClient.AggregatedList(project);
     // End snippet
 }
Пример #2
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, CallSettings)
            // Additional: AggregatedListAsync(string, CancellationToken)
            // Create client
            DisksClient disksClient = await DisksClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            DiskAggregatedList response = await disksClient.AggregatedListAsync(project);

            // End snippet
        }
Пример #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            // Special case. If you specify the Project, Zone, and DiskName we use the Get command to
            // get the specific disk. This will throw a 404 if it does not exist.
            if (!String.IsNullOrEmpty(Project) && !String.IsNullOrEmpty(Zone) && !String.IsNullOrEmpty(DiskName))
            {
                DisksResource.GetRequest getReq = Service.Disks.Get(Project, Zone, DiskName);
                Disk disk = getReq.Execute();
                WriteObject(disk);
                return;
            }

            DisksResource.AggregatedListRequest listReq = Service.Disks.AggregatedList(Project);
            // The v1 version of the API only supports one filter at a time. So we need to
            // specify a filter here and manually filter results later. Also, since the only
            // operations are "eq" and "ne", we don't use the filter for zone so that we can
            // can allow filtering by regions.
            if (!String.IsNullOrEmpty(DiskName))
            {
                listReq.Filter = $"name eq \"{DiskName}\"";
            }

            // First page. AggregatedList.Items is a dictionary of zone to disks.
            DiskAggregatedList disks = listReq.Execute();

            foreach (DisksScopedList diskList in disks.Items.Values)
            {
                WriteDiskObjects(diskList.Disks);
            }

            // Keep paging through results as necessary.
            while (disks.NextPageToken != null)
            {
                listReq.PageToken = disks.NextPageToken;
                disks             = listReq.Execute();
                foreach (DisksScopedList diskList in disks.Items.Values)
                {
                    WriteDiskObjects(diskList.Disks);
                }
            }
        }
Пример #4
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedListRequestObject()
 {
     // Snippet: AggregatedList(AggregatedListDisksRequest, CallSettings)
     // Create client
     DisksClient disksClient = DisksClient.Create();
     // Initialize request argument(s)
     AggregatedListDisksRequest request = new AggregatedListDisksRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         IncludeAllScopes     = false,
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     DiskAggregatedList response = disksClient.AggregatedList(request);
     // End snippet
 }
Пример #5
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListDisksRequest, CallSettings)
            // Additional: AggregatedListAsync(AggregatedListDisksRequest, CancellationToken)
            // Create client
            DisksClient disksClient = await DisksClient.CreateAsync();

            // Initialize request argument(s)
            AggregatedListDisksRequest request = new AggregatedListDisksRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                IncludeAllScopes     = false,
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            DiskAggregatedList response = await disksClient.AggregatedListAsync(request);

            // End snippet
        }