/// <summary>Snippet for DeleteInstanceAsync</summary>
        public async Task DeleteInstanceAsync_RequestObject()
        {
            // Snippet: DeleteInstanceAsync(DeleteInstanceRequest,CallSettings)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            DeleteInstanceRequest request = new DeleteInstanceRequest
            {
                InstanceName = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
            };
            // Make the request
            Operation <Empty, OperationMetadata> response =
                await cloudRedisClient.DeleteInstanceAsync(request);

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

            // The long-running operation is now complete.

            // 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 cloudRedisClient.PollOnceDeleteInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
        /// <summary>Snippet for DeleteInstanceAsync</summary>
        public async Task DeleteInstanceAsync()
        {
            // Snippet: DeleteInstanceAsync(string,CallSettings)
            // Additional: DeleteInstanceAsync(string,CancellationToken)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]").ToString();
            // Make the request
            Operation <Empty, Any> response =
                await cloudRedisClient.DeleteInstanceAsync(formattedName);

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

            // The long-running operation is now complete.

            // 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, Any> retrievedResponse =
                await cloudRedisClient.PollOnceDeleteInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
 /// <summary>Snippet for GetInstanceAsync</summary>
 public async Task GetInstanceAsync()
 {
     // Snippet: GetInstanceAsync(InstanceName,CallSettings)
     // Additional: GetInstanceAsync(InstanceName,CancellationToken)
     // Create client
     CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();
     // Initialize request argument(s)
     InstanceName name = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]");
     // Make the request
     Instance response = await cloudRedisClient.GetInstanceAsync(name);
     // End snippet
 }
        /// <summary>Snippet for UpdateInstanceAsync</summary>
        public async Task UpdateInstanceAsync_RequestObject()
        {
            // Snippet: UpdateInstanceAsync(UpdateInstanceRequest,CallSettings)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            UpdateInstanceRequest request = new UpdateInstanceRequest
            {
                UpdateMask = new FieldMask
                {
                    Paths =
                    {
                        "display_name",
                        "memory_size_gb",
                    },
                },
                Instance = new Instance
                {
                    DisplayName  = "UpdatedDisplayName",
                    MemorySizeGb = 4,
                },
            };
            // Make the request
            Operation <Instance, OperationMetadata> response =
                await cloudRedisClient.UpdateInstanceAsync(request);

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

            // Retrieve the operation result
            Instance 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 <Instance, OperationMetadata> retrievedResponse =
                await cloudRedisClient.PollOnceUpdateInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Instance retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for ListInstancesAsync</summary>
        public async Task ListInstancesAsync_RequestObject()
        {
            // Snippet: ListInstancesAsync(ListInstancesRequest,CallSettings)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            ListInstancesRequest request = new ListInstancesRequest
            {
                ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListInstancesResponse, Instance> response =
                cloudRedisClient.ListInstancesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Instance 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((ListInstancesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Instance item in page)
                {
                    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 <Instance> 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 (Instance item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for GetInstanceAsync</summary>
        public async Task GetInstanceAsync_RequestObject()
        {
            // Snippet: GetInstanceAsync(GetInstanceRequest,CallSettings)
            // Additional: GetInstanceAsync(GetInstanceRequest,CancellationToken)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            GetInstanceRequest request = new GetInstanceRequest
            {
                Name = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]").ToString(),
            };
            // Make the request
            Instance response = await cloudRedisClient.GetInstanceAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateInstanceAsync</summary>
        public async Task CreateInstanceAsync_RequestObject()
        {
            // Snippet: CreateInstanceAsync(CreateInstanceRequest,CallSettings)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            CreateInstanceRequest request = new CreateInstanceRequest
            {
                ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"),
                InstanceId           = "test_instance",
                Instance             = new Instance
                {
                    Tier         = Instance.Types.Tier.Basic,
                    MemorySizeGb = 1,
                },
            };
            // Make the request
            Operation <Instance, OperationMetadata> response =
                await cloudRedisClient.CreateInstanceAsync(request);

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

            // Retrieve the operation result
            Instance 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 <Instance, OperationMetadata> retrievedResponse =
                await cloudRedisClient.PollOnceCreateInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Instance retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for CreateInstanceAsync</summary>
        public async Task CreateInstanceAsync()
        {
            // Snippet: CreateInstanceAsync(string,string,Instance,CallSettings)
            // Additional: CreateInstanceAsync(string,string,Instance,CancellationToken)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            string   formattedParent = new LocationName("[PROJECT]", "[LOCATION]").ToString();
            string   instanceId      = "test_instance";
            Instance instance        = new Instance
            {
                Tier         = Instance.Types.Tier.Basic,
                MemorySizeGb = 1,
            };
            // Make the request
            Operation <Instance, Any> response =
                await cloudRedisClient.CreateInstanceAsync(formattedParent, instanceId, instance);

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

            // Retrieve the operation result
            Instance 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 <Instance, Any> retrievedResponse =
                await cloudRedisClient.PollOnceCreateInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Instance retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for FailoverInstanceAsync</summary>
        public async Task FailoverInstanceAsync_RequestObject()
        {
            // Snippet: FailoverInstanceAsync(FailoverInstanceRequest,CallSettings)
            // Create client
            CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();

            // Initialize request argument(s)
            FailoverInstanceRequest request = new FailoverInstanceRequest
            {
                InstanceName       = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
                DataProtectionMode = FailoverInstanceRequest.Types.DataProtectionMode.Unspecified,
            };
            // Make the request
            Operation <Instance, OperationMetadata> response =
                await cloudRedisClient.FailoverInstanceAsync(request);

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

            // Retrieve the operation result
            Instance 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 <Instance, OperationMetadata> retrievedResponse =
                await cloudRedisClient.PollOnceFailoverInstanceAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Instance retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }