Example #1
0
        /// <summary>Snippet for ProvisionCloudIdentityAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ProvisionCloudIdentityRequestObjectAsync()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = await CloudChannelServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProvisionCloudIdentityRequest request = new ProvisionCloudIdentityRequest
            {
                CustomerAsCustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
                CloudIdentityInfo      = new CloudIdentityInfo(),
                User         = new AdminUser(),
                ValidateOnly = false,
            };
            // Make the request
            Operation <Customer, OperationMetadata> response = await cloudChannelServiceClient.ProvisionCloudIdentityAsync(request);

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

            // Retrieve the operation result
            Customer 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
            Operation <Customer, OperationMetadata> retrievedResponse = await cloudChannelServiceClient.PollOnceProvisionCloudIdentityAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Customer retrievedResult = retrievedResponse.Result;
            }
        }
Example #2
0
        /// <summary>Snippet for CreateEntitlement</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateEntitlementRequestObject()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create();
            // Initialize request argument(s)
            CreateEntitlementRequest request = new CreateEntitlementRequest
            {
                ParentAsCustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
                Entitlement          = new Entitlement(),
                RequestId            = "",
            };
            // Make the request
            Operation <Entitlement, OperationMetadata> response = cloudChannelServiceClient.CreateEntitlement(request);

            // Poll until the returned long-running operation is complete
            Operation <Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Entitlement 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
            Operation <Entitlement, OperationMetadata> retrievedResponse = cloudChannelServiceClient.PollOnceCreateEntitlement(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Entitlement retrievedResult = retrievedResponse.Result;
            }
        }
        public async stt::Task GetCustomerRequestObjectAsync()
        {
            moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetCustomerRequest request = new GetCustomerRequest
            {
                CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
            };
            Customer expectedResponse = new Customer
            {
                CustomerName       = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
                OrgDisplayName     = "org_display_nameb29ddfcb",
                OrgPostalAddress   = new gt::PostalAddress(),
                PrimaryContactInfo = new ContactInfo(),
                AlternateEmail     = "alternate_email3cdfc6ce",
                Domain             = "domaine8825fad",
                CreateTime         = new wkt::Timestamp(),
                UpdateTime         = new wkt::Timestamp(),
                CloudIdentityId    = "cloud_identity_idcb2e1526",
                LanguageCode       = "language_code2f6c7160",
                CloudIdentityInfo  = new CloudIdentityInfo(),
                ChannelPartnerId   = "channel_partner_ida548fd43",
            };

            mockGrpcClient.Setup(x => x.GetCustomerAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Customer>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null);
            Customer responseCallSettings    = await client.GetCustomerAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Customer responseCancellationToken = await client.GetCustomerAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateCustomerRequestObject()
        {
            moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            UpdateCustomerRequest request = new UpdateCustomerRequest
            {
                Customer   = new Customer(),
                UpdateMask = new wkt::FieldMask(),
            };
            Customer expectedResponse = new Customer
            {
                CustomerName       = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
                OrgDisplayName     = "org_display_nameb29ddfcb",
                OrgPostalAddress   = new gt::PostalAddress(),
                PrimaryContactInfo = new ContactInfo(),
                AlternateEmail     = "alternate_email3cdfc6ce",
                Domain             = "domaine8825fad",
                CreateTime         = new wkt::Timestamp(),
                UpdateTime         = new wkt::Timestamp(),
                CloudIdentityId    = "cloud_identity_idcb2e1526",
                LanguageCode       = "language_code2f6c7160",
                CloudIdentityInfo  = new CloudIdentityInfo(),
                ChannelPartnerId   = "channel_partner_ida548fd43",
            };

            mockGrpcClient.Setup(x => x.UpdateCustomer(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null);
            Customer response = client.UpdateCustomer(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #5
0
 /// <summary>Snippet for GetCustomer</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCustomerResourceNames()
 {
     // Create client
     CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create();
     // Initialize request argument(s)
     CustomerName name = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]");
     // Make the request
     Customer response = cloudChannelServiceClient.GetCustomer(name);
 }
        /// <summary>Snippet for GetCustomerAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCustomerResourceNamesAsync()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = await CloudChannelServiceClient.CreateAsync();

            // Initialize request argument(s)
            CustomerName name = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]");
            // Make the request
            Customer response = await cloudChannelServiceClient.GetCustomerAsync(name);
        }
 /// <summary>Snippet for GetCustomer</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCustomerRequestObject()
 {
     // Create client
     CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create();
     // Initialize request argument(s)
     GetCustomerRequest request = new GetCustomerRequest
     {
         CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
     };
     // Make the request
     Customer response = cloudChannelServiceClient.GetCustomer(request);
 }
Example #8
0
        /// <summary>Snippet for DeleteCustomerAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteCustomerRequestObjectAsync()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = await CloudChannelServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteCustomerRequest request = new DeleteCustomerRequest
            {
                CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
            };
            // Make the request
            await cloudChannelServiceClient.DeleteCustomerAsync(request);
        }
        /// <summary>Snippet for ListPurchasableSkusAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ListPurchasableSkusRequestObjectAsync()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = await CloudChannelServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListPurchasableSkusRequest request = new ListPurchasableSkusRequest
            {
                CustomerAsCustomerName    = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
                CreateEntitlementPurchase = new ListPurchasableSkusRequest.Types.CreateEntitlementPurchase(),
                LanguageCode = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListPurchasableSkusResponse, PurchasableSku> response = cloudChannelServiceClient.ListPurchasableSkusAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((PurchasableSku 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((ListPurchasableSkusResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (PurchasableSku 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 <PurchasableSku> 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 (PurchasableSku 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;
        }
Example #10
0
        /// <summary>Snippet for ListEntitlements</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListEntitlementsRequestObject()
        {
            // Create client
            CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create();
            // Initialize request argument(s)
            ListEntitlementsRequest request = new ListEntitlementsRequest
            {
                ParentAsCustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
            };
            // Make the request
            PagedEnumerable <ListEntitlementsResponse, Entitlement> response = cloudChannelServiceClient.ListEntitlements(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Entitlement 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 <Entitlement> 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 (Entitlement 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;
        }
        public void DeleteCustomerResourceNames()
        {
            moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            DeleteCustomerRequest request = new DeleteCustomerRequest
            {
                CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteCustomer(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteCustomer(request.CustomerName);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task DeleteCustomerResourceNamesAsync()
        {
            moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            DeleteCustomerRequest request = new DeleteCustomerRequest
            {
                CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteCustomerAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteCustomerAsync(request.CustomerName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteCustomerAsync(request.CustomerName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }