Exemplo n.º 1
0
        private static void CreateTag(KmsClient kmsClient)
        {
            var tagItem = new TagItem();

            tagItem.Key   = "key";
            tagItem.Value = "value";
            try
            {
                var req = new CreateKmsTagRequest
                {
                    VersionId = "v1.0",
                    KeyId     = GetKeyByStatus.GetKeyByKeyStatus(kmsClient, "2"),
                    Body      = new CreateKmsTagRequestBody
                    {
                        Tag = tagItem
                    }
                };
                var resp = kmsClient.CreateKmsTag(req);
                Console.WriteLine(resp.HttpStatusCode);
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }