Пример #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
        }
Пример #2
0
        /// <summary>Snippet for Delete</summary>
        public void Delete()
        {
            // Snippet: Delete(string, string, CallSettings)
            // Create client
            LicensesClient licensesClient = LicensesClient.Create();
            // Initialize request argument(s)
            string project = "";
            string license = "";
            // Make the request
            lro::Operation <Operation, Operation> response = licensesClient.Delete(project, license);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted();
            // 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 = licensesClient.PollOnceDelete(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
        }
Пример #3
0
        /// <summary>Snippet for Insert</summary>
        public void InsertRequestObject()
        {
            // Snippet: Insert(InsertLicenseRequest, CallSettings)
            // Create client
            LicensesClient licensesClient = LicensesClient.Create();
            // Initialize request argument(s)
            InsertLicenseRequest request = new InsertLicenseRequest
            {
                RequestId       = "",
                Project         = "",
                LicenseResource = new License(),
            };
            // Make the request
            lro::Operation <Operation, Operation> response = licensesClient.Insert(request);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted();
            // 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 = licensesClient.PollOnceInsert(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
        }
Пример #4
0
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            LicenseDetailDto license = new LicenseDetailDto
            {
                SoftwareId    = SoftwareId,
                Edition       = txtEdition.Text,
                ActivationKey = txtActivationKey.Text,
                VolumeLicense = false
            };

            bool?success;

            using (var client = new LicensesClient())
            {
                success = await client.PostLicense(license);
            }
            if (success == null)
            {
                throw new NotImplementedException();
            }
            if (!success.HasValue)
            {
                throw new NotImplementedException();
            }
            if (!success.Value)
            {
                throw new NotImplementedException();
            }
            this.Close();
        }
Пример #5
0
 /// <summary>Snippet for List</summary>
 public void List()
 {
     // Snippet: List(string, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string project = "";
     // Make the request
     LicensesListResponse response = licensesClient.List(project);
     // End snippet
 }
Пример #6
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy()
 {
     // Snippet: GetIamPolicy(string, string, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string project  = "";
     string resource = "";
     // Make the request
     Policy response = licensesClient.GetIamPolicy(project, resource);
     // End snippet
 }
Пример #7
0
 /// <summary>Snippet for Delete</summary>
 public void Delete()
 {
     // Snippet: Delete(string, string, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string project = "";
     string license = "";
     // Make the request
     Operation response = licensesClient.Delete(project, license);
     // End snippet
 }
Пример #8
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, License, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string  project         = "";
     License licenseResource = new License();
     // Make the request
     Operation response = licensesClient.Insert(project, licenseResource);
     // End snippet
 }
Пример #9
0
 /// <summary>Snippet for SetIamPolicy</summary>
 public void SetIamPolicy()
 {
     // Snippet: SetIamPolicy(string, string, GlobalSetPolicyRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string project  = "";
     string resource = "";
     GlobalSetPolicyRequest globalSetPolicyRequestResource = new GlobalSetPolicyRequest();
     // Make the request
     Policy response = licensesClient.SetIamPolicy(project, resource, globalSetPolicyRequestResource);
     // End snippet
 }
Пример #10
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissions()
 {
     // Snippet: TestIamPermissions(string, string, TestPermissionsRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     string project  = "";
     string resource = "";
     TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
     // Make the request
     TestPermissionsResponse response = licensesClient.TestIamPermissions(project, resource, testPermissionsRequestResource);
     // 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
        }
Пример #12
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
        }
Пример #13
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
        }
Пример #14
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     GetLicenseRequest request = new GetLicenseRequest
     {
         License = "",
         Project = "",
     };
     // Make the request
     License response = licensesClient.Get(request);
     // End snippet
 }
Пример #15
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
        }
Пример #16
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
        }
Пример #17
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsLicenseRequest request = new TestIamPermissionsLicenseRequest
     {
         Resource = "",
         Project  = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
     };
     // Make the request
     TestPermissionsResponse response = licensesClient.TestIamPermissions(request);
     // End snippet
 }
Пример #18
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
        }
Пример #19
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicyRequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     GetIamPolicyLicenseRequest request = new GetIamPolicyLicenseRequest
     {
         Resource = "",
         Project  = "",
         OptionsRequestedPolicyVersion = 0,
     };
     // Make the request
     Policy response = licensesClient.GetIamPolicy(request);
     // End snippet
 }
Пример #20
0
 /// <summary>Snippet for SetIamPolicy</summary>
 public void SetIamPolicyRequestObject()
 {
     // Snippet: SetIamPolicy(SetIamPolicyLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     SetIamPolicyLicenseRequest request = new SetIamPolicyLicenseRequest
     {
         Resource = "",
         Project  = "",
         GlobalSetPolicyRequestResource = new GlobalSetPolicyRequest(),
     };
     // Make the request
     Policy response = licensesClient.SetIamPolicy(request);
     // End snippet
 }
Пример #21
0
 /// <summary>Snippet for Insert</summary>
 public void InsertRequestObject()
 {
     // Snippet: Insert(InsertLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     InsertLicenseRequest request = new InsertLicenseRequest
     {
         RequestId       = "",
         Project         = "",
         LicenseResource = new License(),
     };
     // Make the request
     Operation response = licensesClient.Insert(request);
     // End snippet
 }
Пример #22
0
 /// <summary>Snippet for Delete</summary>
 public void DeleteRequestObject()
 {
     // Snippet: Delete(DeleteLicenseRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     DeleteLicenseRequest request = new DeleteLicenseRequest
     {
         RequestId = "",
         License   = "",
         Project   = "",
     };
     // Make the request
     Operation response = licensesClient.Delete(request);
     // End snippet
 }
Пример #23
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
        }
        /// <summary>Snippet for List</summary>
        public void List()
        {
            // Snippet: List(string, string, int?, CallSettings)
            // Create client
            LicensesClient licensesClient = LicensesClient.Create();
            // Initialize request argument(s)
            string project = "";
            // Make the request
            PagedEnumerable <LicensesListResponse, License> response = licensesClient.List(project);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (License item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (LicensesListResponse page in response.AsRawResponses())
            {
                // 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 = response.ReadPage(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
        }
Пример #25
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
        }
Пример #26
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
        }
Пример #27
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
        }
Пример #28
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
        }
Пример #29
0
 /// <summary>Snippet for List</summary>
 public void ListRequestObject()
 {
     // Snippet: List(ListLicensesRequest, CallSettings)
     // Create client
     LicensesClient licensesClient = LicensesClient.Create();
     // Initialize request argument(s)
     ListLicensesRequest request = new ListLicensesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         OrderBy              = "",
         Project              = "",
         Filter               = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     LicensesListResponse response = licensesClient.List(request);
     // End snippet
 }
Пример #30
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
        }