Пример #1
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, License, CallSettings)
            // Additional: InsertAsync(string, License, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            string  project         = "";
            License licenseResource = new License();
            // Make the request
            lro::Operation <Operation, Operation> response = await licensesClient.InsertAsync(project, licenseResource);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Operation result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            lro::Operation <Operation, Operation> retrievedResponse = await licensesClient.PollOnceInsertAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListLicensesRequest, CallSettings)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            ListLicensesRequest request = new ListLicensesRequest
            {
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <LicensesListResponse, License> response = licensesClient.ListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((License 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((LicensesListResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (License 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 <License> 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 (License 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
        }
Пример #3
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListAsync()
        {
            // Snippet: ListAsync(string, CallSettings)
            // Additional: ListAsync(string, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            LicensesListResponse response = await licensesClient.ListAsync(project);

            // End snippet
        }
Пример #4
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteAsync()
        {
            // Snippet: DeleteAsync(string, string, CallSettings)
            // Additional: DeleteAsync(string, string, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

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

            // End snippet
        }
Пример #5
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, License, CallSettings)
            // Additional: InsertAsync(string, License, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            string  project         = "";
            License licenseResource = new License();
            // Make the request
            Operation response = await licensesClient.InsertAsync(project, licenseResource);

            // End snippet
        }
Пример #6
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync()
        {
            // Snippet: GetIamPolicyAsync(string, string, CallSettings)
            // Additional: GetIamPolicyAsync(string, string, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

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

            // End snippet
        }
Пример #7
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsAsync()
        {
            // Snippet: TestIamPermissionsAsync(string, string, TestPermissionsRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(string, string, TestPermissionsRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

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

            // End snippet
        }
Пример #8
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetLicenseRequest, CallSettings)
            // Additional: GetAsync(GetLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            GetLicenseRequest request = new GetLicenseRequest
            {
                License = "",
                Project = "",
            };
            // Make the request
            License response = await licensesClient.GetAsync(request);

            // End snippet
        }
Пример #9
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsRequestObjectAsync()
        {
            // Snippet: TestIamPermissionsAsync(TestIamPermissionsLicenseRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(TestIamPermissionsLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

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

            // End snippet
        }
Пример #10
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteLicenseRequest, CallSettings)
            // Additional: DeleteAsync(DeleteLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            DeleteLicenseRequest request = new DeleteLicenseRequest
            {
                RequestId = "",
                License   = "",
                Project   = "",
            };
            // Make the request
            Operation response = await licensesClient.DeleteAsync(request);

            // End snippet
        }
Пример #11
0
        /// <summary>Snippet for SetIamPolicyAsync</summary>
        public async Task SetIamPolicyRequestObjectAsync()
        {
            // Snippet: SetIamPolicyAsync(SetIamPolicyLicenseRequest, CallSettings)
            // Additional: SetIamPolicyAsync(SetIamPolicyLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            SetIamPolicyLicenseRequest request = new SetIamPolicyLicenseRequest
            {
                Resource = "",
                Project  = "",
                GlobalSetPolicyRequestResource = new GlobalSetPolicyRequest(),
            };
            // Make the request
            Policy response = await licensesClient.SetIamPolicyAsync(request);

            // End snippet
        }
Пример #12
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertLicenseRequest, CallSettings)
            // Additional: InsertAsync(InsertLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            InsertLicenseRequest request = new InsertLicenseRequest
            {
                RequestId       = "",
                Project         = "",
                LicenseResource = new License(),
            };
            // Make the request
            Operation response = await licensesClient.InsertAsync(request);

            // End snippet
        }
Пример #13
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyRequestObjectAsync()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyLicenseRequest, CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyLicenseRequest request = new GetIamPolicyLicenseRequest
            {
                Resource = "",
                Project  = "",
                OptionsRequestedPolicyVersion = 0,
            };
            // Make the request
            Policy response = await licensesClient.GetIamPolicyAsync(request);

            // End snippet
        }
Пример #14
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListLicensesRequest, CallSettings)
            // Additional: ListAsync(ListLicensesRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

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

            // End snippet
        }
Пример #15
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteLicenseRequest, CallSettings)
            // Additional: DeleteAsync(DeleteLicenseRequest, CancellationToken)
            // Create client
            LicensesClient licensesClient = await LicensesClient.CreateAsync();

            // Initialize request argument(s)
            DeleteLicenseRequest request = new DeleteLicenseRequest
            {
                RequestId = "",
                License   = "",
                Project   = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = await licensesClient.DeleteAsync(request);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Operation result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            lro::Operation <Operation, Operation> retrievedResponse = await licensesClient.PollOnceDeleteAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }