Exemple #1
0
        /// <summary>
        /// Set a Label value on the backing GameServer record that is stored in Kubernetes.
        /// </summary>
        /// <param name="key">Label key</param>
        /// <param name="value">Label value</param>
        /// <returns>gRPC Status of the request</returns>
        public async Task <Status> SetLabelAsync(string key, string value)
        {
            try
            {
                await client.SetLabelAsync(new KeyValue()
                {
                    Key   = key,
                    Value = value
                }, deadline : DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken : ctoken);

                return(new Status(StatusCode.OK, $"SetLabel {key}:{value} request successful."));
            }
            catch (RpcException ex)
            {
                LogError(ex, $"Unable to set the GameServer label '{key}' to '{value}'.");
                return(ex.Status);
            }
        }
Exemple #2
0
        /// <summary>
        /// Set a Label value on the backing GameServer record that is stored in Kubernetes.
        /// </summary>
        /// <param name="key">Label key</param>
        /// <param name="value">Label value</param>
        /// <returns>gRPC Status of the request</returns>
        public async Task <Status> SetLabelAsync(string key, string value)
        {
            try
            {
                await client.SetLabelAsync(new KeyValue()
                {
                    Key   = key,
                    Value = value
                }, deadline : DateTime.UtcNow.AddSeconds(RequestTimeout), cancellationToken : ctoken);

                return(new Status(StatusCode.OK, $"SetLabel {key}:{value} request successful."));
            }
            catch (RpcException ex)
            {
                Console.Error.WriteLine(ex.Message);
                return(ex.Status);
            }
        }