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

                return(new Status(StatusCode.OK, $"SetAnnotation {key}:{value} request successful."));
            }
            catch (RpcException ex)
            {
                LogError(ex, $"Unable to set the GameServer annotation '{key}' to '{value}'.");
                return(ex.Status);
            }
        }
コード例 #2
0
ファイル: AgonesSDK.cs プロジェクト: yuryu/agones
        /// <summary>
        /// Set a Annotation value on the backing Gameserver record that is stored in Kubernetes.
        /// </summary>
        /// <param name="key">Annotation key</param>
        /// <param name="value">Annotation value</param>
        /// <returns>gRPC Status of the request</returns>
        public async Task <Status> SetAnnotationAsync(string key, string value)
        {
            try
            {
                await client.SetAnnotationAsync(new KeyValue()
                {
                    Key   = key,
                    Value = value
                }, deadline : DateTime.UtcNow.AddSeconds(RequestTimeout), cancellationToken : ctoken);

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