Пример #1
0
        /// <summary>Snippet for CreateGatewayAsync</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 CreateGatewayAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            string  parent    = "projects/[PROJECT]/locations/[LOCATION]";
            Gateway gateway   = new Gateway();
            string  gatewayId = "";
            // Make the request
            Operation <Gateway, OperationMetadata> response = await apiGatewayServiceClient.CreateGatewayAsync(parent, gateway, gatewayId);

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

            // Retrieve the operation result
            Gateway 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 <Gateway, OperationMetadata> retrievedResponse = await apiGatewayServiceClient.PollOnceCreateGatewayAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Gateway retrievedResult = retrievedResponse.Result;
            }
        }
Пример #2
0
        /// <summary>Snippet for UpdateApiConfigAsync</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 UpdateApiConfigRequestObjectAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateApiConfigRequest request = new UpdateApiConfigRequest
            {
                UpdateMask = new FieldMask(),
                ApiConfig  = new ApiConfig(),
            };
            // Make the request
            Operation <ApiConfig, OperationMetadata> response = await apiGatewayServiceClient.UpdateApiConfigAsync(request);

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

            // Retrieve the operation result
            ApiConfig 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 <ApiConfig, OperationMetadata> retrievedResponse = await apiGatewayServiceClient.PollOnceUpdateApiConfigAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ApiConfig retrievedResult = retrievedResponse.Result;
            }
        }
Пример #3
0
        /// <summary>Snippet for CreateApiAsync</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 CreateApiResourceNamesAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            Api          api    = new Api();
            string       apiId  = "";
            // Make the request
            Operation <Api, OperationMetadata> response = await apiGatewayServiceClient.CreateApiAsync(parent, api, apiId);

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

            // Retrieve the operation result
            Api 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 <Api, OperationMetadata> retrievedResponse = await apiGatewayServiceClient.PollOnceCreateApiAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Api retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for DeleteApiAsync</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 DeleteApiResourceNamesAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            ApiName name = ApiName.FromProjectApi("[PROJECT]", "[API]");
            // Make the request
            Operation <Empty, OperationMetadata> response = await apiGatewayServiceClient.DeleteApiAsync(name);

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

            // Retrieve the operation result
            Empty 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 <Empty, OperationMetadata> retrievedResponse = await apiGatewayServiceClient.PollOnceDeleteApiAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
        /// <summary>Snippet for DeleteApiConfigAsync</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 DeleteApiConfigAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/global/apis/[API]/configs/[API_CONFIG]";
            // Make the request
            Operation <Empty, OperationMetadata> response = await apiGatewayServiceClient.DeleteApiConfigAsync(name);

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

            // Retrieve the operation result
            Empty 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 <Empty, OperationMetadata> retrievedResponse = await apiGatewayServiceClient.PollOnceDeleteApiConfigAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
 /// <summary>Snippet for GetGatewayAsync</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 GetGatewayResourceNamesAsync()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();
     // Initialize request argument(s)
     GatewayName name = GatewayName.FromProjectLocationGateway("[PROJECT]", "[LOCATION]", "[GATEWAY]");
     // Make the request
     Gateway response = await apiGatewayServiceClient.GetGatewayAsync(name);
 }
        /// <summary>Snippet for GetGatewayAsync</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 GetGatewayAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/gateways/[GATEWAY]";
            // Make the request
            Gateway response = await apiGatewayServiceClient.GetGatewayAsync(name);
        }
Пример #8
0
        /// <summary>Snippet for GetApiConfigAsync</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 GetApiConfigAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/global/apis/[API]/configs/[API_CONFIG]";
            // Make the request
            ApiConfig response = await apiGatewayServiceClient.GetApiConfigAsync(name);
        }
        /// <summary>Snippet for GetApiConfigAsync</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 GetApiConfigResourceNamesAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            ApiConfigName name = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]");
            // Make the request
            ApiConfig response = await apiGatewayServiceClient.GetApiConfigAsync(name);
        }
        /// <summary>Snippet for GetApiAsync</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 GetApiRequestObjectAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetApiRequest request = new GetApiRequest
            {
                ApiName = ApiName.FromProjectApi("[PROJECT]", "[API]"),
            };
            // Make the request
            Api response = await apiGatewayServiceClient.GetApiAsync(request);
        }
        /// <summary>Snippet for GetApiConfigAsync</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 GetApiConfigRequestObjectAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetApiConfigRequest request = new GetApiConfigRequest
            {
                ApiConfigName = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]"),
                View          = GetApiConfigRequest.Types.ConfigView.Unspecified,
            };
            // Make the request
            ApiConfig response = await apiGatewayServiceClient.GetApiConfigAsync(request);
        }
Пример #12
0
        /// <summary>Snippet for ListApisAsync</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 ListApisRequestObjectAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListApisRequest request = new ListApisRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter  = "",
                OrderBy = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListApisResponse, Api> response = apiGatewayServiceClient.ListApisAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Api 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((ListApisResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Api 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 <Api> 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 (Api 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;
        }
Пример #13
0
        /// <summary>Snippet for ListGatewaysAsync</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 ListGatewaysAsync()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = await ApiGatewayServiceClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]";
            // Make the request
            PagedAsyncEnumerable <ListGatewaysResponse, Gateway> response = apiGatewayServiceClient.ListGatewaysAsync(parent);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Gateway 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((ListGatewaysResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Gateway 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 <Gateway> 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 (Gateway 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;
        }