/// <summary>Snippet for DeleteTenantAsync</summary>
        public async Task DeleteTenantAsync()
        {
            // Snippet: DeleteTenantAsync(string, CallSettings)
            // Additional: DeleteTenantAsync(string, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/tenants/[TENANT]";
            // Make the request
            await tenantServiceClient.DeleteTenantAsync(name);

            // End snippet
        }
        /// <summary>Snippet for DeleteTenantAsync</summary>
        public async Task DeleteTenantResourceNamesAsync()
        {
            // Snippet: DeleteTenantAsync(TenantName, CallSettings)
            // Additional: DeleteTenantAsync(TenantName, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            TenantName name = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]");
            // Make the request
            await tenantServiceClient.DeleteTenantAsync(name);

            // End snippet
        }
        /// <summary>Snippet for UpdateTenantAsync</summary>
        public async Task UpdateTenantAsync()
        {
            // Snippet: UpdateTenantAsync(Tenant, CallSettings)
            // Additional: UpdateTenantAsync(Tenant, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            Tenant tenant = new Tenant();
            // Make the request
            Tenant response = await tenantServiceClient.UpdateTenantAsync(tenant);

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

            // Initialize request argument(s)
            TenantName name = new TenantName("[PROJECT]", "[TENANT]");
            // Make the request
            Tenant response = await tenantServiceClient.GetTenantAsync(name);

            // End snippet
        }
        /// <summary>Snippet for CreateTenantAsync</summary>
        public async Task CreateTenantAsync()
        {
            // Snippet: CreateTenantAsync(string, Tenant, CallSettings)
            // Additional: CreateTenantAsync(string, Tenant, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            Tenant tenant = new Tenant();
            // Make the request
            Tenant response = await tenantServiceClient.CreateTenantAsync(parent, tenant);

            // End snippet
        }
        /// <summary>Snippet for CreateTenantAsync</summary>
        public async Task CreateTenantResourceNamesAsync()
        {
            // Snippet: CreateTenantAsync(ProjectName, Tenant, CallSettings)
            // Additional: CreateTenantAsync(ProjectName, Tenant, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = ProjectName.FromProject("[PROJECT]");
            Tenant      tenant = new Tenant();
            // Make the request
            Tenant response = await tenantServiceClient.CreateTenantAsync(parent, tenant);

            // End snippet
        }
        /// <summary>Snippet for ListTenantsAsync</summary>
        public async Task ListTenantsRequestObjectAsync()
        {
            // Snippet: ListTenantsAsync(ListTenantsRequest, CallSettings)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListTenantsRequest request = new ListTenantsRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListTenantsResponse, Tenant> response = tenantServiceClient.ListTenantsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Tenant 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((ListTenantsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Tenant 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 <Tenant> 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 (Tenant 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
        }
        /// <summary>Snippet for DeleteTenantAsync</summary>
        public async Task DeleteTenantRequestObjectAsync()
        {
            // Snippet: DeleteTenantAsync(DeleteTenantRequest, CallSettings)
            // Additional: DeleteTenantAsync(DeleteTenantRequest, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteTenantRequest request = new DeleteTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            // Make the request
            await tenantServiceClient.DeleteTenantAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateTenantAsync</summary>
        public async Task CreateTenantRequestObjectAsync()
        {
            // Snippet: CreateTenantAsync(CreateTenantRequest, CallSettings)
            // Additional: CreateTenantAsync(CreateTenantRequest, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateTenantRequest request = new CreateTenantRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Tenant = new Tenant(),
            };
            // Make the request
            Tenant response = await tenantServiceClient.CreateTenantAsync(request);

            // End snippet
        }
        /// <summary>Snippet for UpdateTenantAsync</summary>
        public async Task UpdateTenantRequestObjectAsync()
        {
            // Snippet: UpdateTenantAsync(UpdateTenantRequest, CallSettings)
            // Additional: UpdateTenantAsync(UpdateTenantRequest, CancellationToken)
            // Create client
            TenantServiceClient tenantServiceClient = await TenantServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateTenantRequest request = new UpdateTenantRequest
            {
                Tenant     = new Tenant(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Tenant response = await tenantServiceClient.UpdateTenantAsync(request);

            // End snippet
        }