Ejemplo n.º 1
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListReservationsRequest, CallSettings)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            AggregatedListReservationsRequest request = new AggregatedListReservationsRequest
            {
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                IncludeAllScopes     = false,
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <ReservationAggregatedList, KeyValuePair <string, ReservationsScopedList> > response = reservationsClient.AggregatedListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((KeyValuePair <string, ReservationsScopedList> item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ReservationAggregatedList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (KeyValuePair <string, ReservationsScopedList> item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <KeyValuePair <string, ReservationsScopedList> > singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (KeyValuePair <string, ReservationsScopedList> item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Ejemplo n.º 2
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, CallSettings)
            // Additional: AggregatedListAsync(string, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

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

            // End snippet
        }
Ejemplo n.º 3
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, Reservation, CallSettings)
            // Additional: InsertAsync(string, string, Reservation, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            string      project             = "";
            string      zone                = "";
            Reservation reservationResource = new Reservation();
            // Make the request
            Operation response = await reservationsClient.InsertAsync(project, zone, reservationResource);

            // End snippet
        }
Ejemplo n.º 4
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync()
        {
            // Snippet: GetIamPolicyAsync(string, string, string, CallSettings)
            // Additional: GetIamPolicyAsync(string, string, string, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            string project  = "";
            string zone     = "";
            string resource = "";
            // Make the request
            Policy response = await reservationsClient.GetIamPolicyAsync(project, zone, resource);

            // End snippet
        }
Ejemplo n.º 5
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteAsync()
        {
            // Snippet: DeleteAsync(string, string, string, CallSettings)
            // Additional: DeleteAsync(string, string, string, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            string project     = "";
            string zone        = "";
            string reservation = "";
            // Make the request
            Operation response = await reservationsClient.DeleteAsync(project, zone, reservation);

            // End snippet
        }
Ejemplo n.º 6
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsAsync()
        {
            // Snippet: TestIamPermissionsAsync(string, string, string, TestPermissionsRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(string, string, string, TestPermissionsRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            string project  = "";
            string zone     = "";
            string resource = "";
            TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
            // Make the request
            TestPermissionsResponse response = await reservationsClient.TestIamPermissionsAsync(project, zone, resource, testPermissionsRequestResource);

            // End snippet
        }
Ejemplo n.º 7
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListAsync()
        {
            // Snippet: ListAsync(string, string, string, int?, CallSettings)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string zone    = "";
            // Make the request
            PagedAsyncEnumerable <ReservationList, Reservation> response = reservationsClient.ListAsync(project, zone);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Reservation item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ReservationList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Reservation item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Reservation> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Reservation item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Ejemplo n.º 8
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetReservationRequest, CallSettings)
            // Additional: GetAsync(GetReservationRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            GetReservationRequest request = new GetReservationRequest
            {
                Zone        = "",
                Reservation = "",
                Project     = "",
            };
            // Make the request
            Reservation response = await reservationsClient.GetAsync(request);

            // End snippet
        }
Ejemplo n.º 9
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsRequestObjectAsync()
        {
            // Snippet: TestIamPermissionsAsync(TestIamPermissionsReservationRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(TestIamPermissionsReservationRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            TestIamPermissionsReservationRequest request = new TestIamPermissionsReservationRequest
            {
                Zone     = "",
                Resource = "",
                Project  = "",
                TestPermissionsRequestResource = new TestPermissionsRequest(),
            };
            // Make the request
            TestPermissionsResponse response = await reservationsClient.TestIamPermissionsAsync(request);

            // End snippet
        }
Ejemplo n.º 10
0
        /// <summary>Snippet for SetIamPolicyAsync</summary>
        public async Task SetIamPolicyRequestObjectAsync()
        {
            // Snippet: SetIamPolicyAsync(SetIamPolicyReservationRequest, CallSettings)
            // Additional: SetIamPolicyAsync(SetIamPolicyReservationRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            SetIamPolicyReservationRequest request = new SetIamPolicyReservationRequest
            {
                Zone     = "",
                Resource = "",
                Project  = "",
                ZoneSetPolicyRequestResource = new ZoneSetPolicyRequest(),
            };
            // Make the request
            Policy response = await reservationsClient.SetIamPolicyAsync(request);

            // End snippet
        }
Ejemplo n.º 11
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertReservationRequest, CallSettings)
            // Additional: InsertAsync(InsertReservationRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            InsertReservationRequest request = new InsertReservationRequest
            {
                Zone                = "",
                RequestId           = "",
                Project             = "",
                ReservationResource = new Reservation(),
            };
            // Make the request
            Operation response = await reservationsClient.InsertAsync(request);

            // End snippet
        }
Ejemplo n.º 12
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListReservationsRequest, CallSettings)
            // Additional: AggregatedListAsync(AggregatedListReservationsRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

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

            // End snippet
        }
Ejemplo n.º 13
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListReservationsRequest, CallSettings)
            // Additional: ListAsync(ListReservationsRequest, CancellationToken)
            // Create client
            ReservationsClient reservationsClient = await ReservationsClient.CreateAsync();

            // Initialize request argument(s)
            ListReservationsRequest request = new ListReservationsRequest
            {
                Zone                 = "",
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            ReservationList response = await reservationsClient.ListAsync(request);

            // End snippet
        }