Exemplo n.º 1
0
        /// <summary>Snippet for CreateGateway</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateGatewayResourceNames()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            LocationName parent    = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            Gateway      gateway   = new Gateway();
            string       gatewayId = "";
            // Make the request
            Operation <Gateway, OperationMetadata> response = apiGatewayServiceClient.CreateGateway(parent, gateway, gatewayId);

            // Poll until the returned long-running operation is complete
            Operation <Gateway, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceCreateGateway(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;
            }
        }
Exemplo n.º 2
0
        /// <summary>Snippet for CreateApiConfig</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateApiConfigRequestObject()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            CreateApiConfigRequest request = new CreateApiConfigRequest
            {
                ParentAsApiName = ApiName.FromProjectApi("[PROJECT]", "[API]"),
                ApiConfigId     = "",
                ApiConfig       = new ApiConfig(),
            };
            // Make the request
            Operation <ApiConfig, OperationMetadata> response = apiGatewayServiceClient.CreateApiConfig(request);

            // Poll until the returned long-running operation is complete
            Operation <ApiConfig, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceCreateApiConfig(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;
            }
        }
Exemplo n.º 3
0
        /// <summary>Snippet for DeleteApi</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteApi()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/global/apis/[API]";
            // Make the request
            Operation <Empty, OperationMetadata> response = apiGatewayServiceClient.DeleteApi(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceDeleteApi(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 DeleteGateway</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteGatewayRequestObject()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            DeleteGatewayRequest request = new DeleteGatewayRequest
            {
                GatewayName = GatewayName.FromProjectLocationGateway("[PROJECT]", "[LOCATION]", "[GATEWAY]"),
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = apiGatewayServiceClient.DeleteGateway(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceDeleteGateway(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 UpdateGateway</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void UpdateGateway()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            Gateway   gateway    = new Gateway();
            FieldMask updateMask = new FieldMask();
            // Make the request
            Operation <Gateway, OperationMetadata> response = apiGatewayServiceClient.UpdateGateway(gateway, updateMask);

            // Poll until the returned long-running operation is complete
            Operation <Gateway, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceUpdateGateway(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;
            }
        }
Exemplo n.º 6
0
        /// <summary>Snippet for CreateApi</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateApi()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]";
            Api    api    = new Api();
            string apiId  = "";
            // Make the request
            Operation <Api, OperationMetadata> response = apiGatewayServiceClient.CreateApi(parent, api, apiId);

            // Poll until the returned long-running operation is complete
            Operation <Api, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceCreateApi(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 DeleteApiConfig</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteApiConfigResourceNames()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            ApiConfigName name = ApiConfigName.FromProjectApiApiConfig("[PROJECT]", "[API]", "[API_CONFIG]");
            // Make the request
            Operation <Empty, OperationMetadata> response = apiGatewayServiceClient.DeleteApiConfig(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = apiGatewayServiceClient.PollOnceDeleteApiConfig(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;
            }
        }
Exemplo n.º 8
0
        /// <summary>Snippet for UpdateApi</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void UpdateApiRequestObject()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            UpdateApiRequest request = new UpdateApiRequest
            {
                UpdateMask = new FieldMask(),
                Api        = new gcav::Api(),
            };
            // Make the request
            Operation <gcav::Api, OperationMetadata> response = apiGatewayServiceClient.UpdateApi(request);

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

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Api retrievedResult = retrievedResponse.Result;
            }
        }
 /// <summary>Snippet for GetGateway</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGatewayResourceNames()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     GatewayName name = GatewayName.FromProjectLocationGateway("[PROJECT]", "[LOCATION]", "[GATEWAY]");
     // Make the request
     Gateway response = apiGatewayServiceClient.GetGateway(name);
 }
 /// <summary>Snippet for GetGateway</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGateway()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/gateways/[GATEWAY]";
     // Make the request
     Gateway response = apiGatewayServiceClient.GetGateway(name);
 }
Exemplo n.º 11
0
 /// <summary>Snippet for GetApi</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetApiResourceNames()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     ApiName name = ApiName.FromProjectApi("[PROJECT]", "[API]");
     // Make the request
     Api response = apiGatewayServiceClient.GetApi(name);
 }
Exemplo n.º 12
0
 /// <summary>Snippet for GetApiConfig</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetApiConfig()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/global/apis/[API]/configs/[API_CONFIG]";
     // Make the request
     ApiConfig response = apiGatewayServiceClient.GetApiConfig(name);
 }
Exemplo n.º 13
0
 /// <summary>Snippet for GetApi</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetApiRequestObject()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     GetApiRequest request = new GetApiRequest
     {
         ApiName = ApiName.FromProjectApi("[PROJECT]", "[API]"),
     };
     // Make the request
     Api response = apiGatewayServiceClient.GetApi(request);
 }
Exemplo n.º 14
0
 /// <summary>Snippet for GetGateway</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGatewayRequestObject()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // Initialize request argument(s)
     GetGatewayRequest request = new GetGatewayRequest
     {
         GatewayName = GatewayName.FromProjectLocationGateway("[PROJECT]", "[LOCATION]", "[GATEWAY]"),
     };
     // Make the request
     Gateway response = apiGatewayServiceClient.GetGateway(request);
 }
 /// <summary>Snippet for GetApiConfig</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetApiConfigRequestObject()
 {
     // Create client
     ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
     // 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 = apiGatewayServiceClient.GetApiConfig(request);
 }
Exemplo n.º 16
0
        /// <summary>Snippet for ListApiConfigs</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListApiConfigsRequestObject()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            ListApiConfigsRequest request = new ListApiConfigsRequest
            {
                ParentAsApiName = ApiName.FromProjectApi("[PROJECT]", "[API]"),
                Filter          = "",
                OrderBy         = "",
            };
            // Make the request
            PagedEnumerable <ListApiConfigsResponse, ApiConfig> response = apiGatewayServiceClient.ListApiConfigs(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (ApiConfig 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 (ListApiConfigsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ApiConfig 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 <ApiConfig> 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 (ApiConfig 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;
        }
Exemplo n.º 17
0
        /// <summary>Snippet for ListApis</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListApis()
        {
            // Create client
            ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create();
            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]";
            // Make the request
            PagedEnumerable <ListApisResponse, Api> response = apiGatewayServiceClient.ListApis(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Api 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 (ListApisResponse page in response.AsRawResponses())
            {
                // 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 = response.ReadPage(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;
        }