using Google.Cloud.Gaming.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
public class DeleteConfigSample
{
public void DeleteConfig(
string projectId, string regionId, string deploymentId, string configId)
{
// Create the client.
GameServerConfigsServiceClient client = GameServerConfigsServiceClient.Create();
DeleteGameServerConfigRequest request = new DeleteGameServerConfigRequest
{
GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig(projectId, regionId, deploymentId, configId)
};
// Make the request.
Operation<Empty, OperationMetadata> response = client.DeleteGameServerConfig(request);
// Poll until the returned long-running operation is complete.
response.PollUntilCompleted();
}
}
const {
GameServerConfigsServiceClient,
} = require('@google-cloud/game-servers');
const client = new GameServerConfigsServiceClient();
async function deleteGameServerConfig() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const deploymentId = 'A unique ID for the Game Server Deployment';
// const configId = 'A unique ID for the Game Server Config';
const request = {
// The full resource name
name: client.gameServerConfigPath(
projectId,
'global',
deploymentId,
configId
),
};
const [operation] = await client.deleteGameServerConfig(request);
await operation.promise();
console.log(`Config with name ${request.name} deleted.`);
}
deleteGameServerConfig();
def delete_config(project_id, deployment_id, config_id):
"""Deletes a game server config."""
client = gaming.GameServerConfigsServiceClient()
# Location is hard coded as global, as game server configs can
# only be created in global. This is done for all operations on
# game server configs.
request = game_server_configs.DeleteGameServerConfigRequest(
name=f"projects/{project_id}/locations/global/gameServerDeployments/{deployment_id}/configs/{config_id}",
)
operation = client.delete_game_server_config(request)
print(f"Delete config operation: {operation.operation.name}")
operation.result(timeout=120)