Пример #1
0
 public SSMStructure readParameter()
 {
     Amazon.SimpleSystemsManagement.Model.GetParameterRequest request = new Amazon.SimpleSystemsManagement.Model.GetParameterRequest();
     request.Name = Resources.SSMParam;
     request.WithDecryption = false;
     string result = client.GetParameter(request).Parameter.Value;
     SSMStructure structure = JsonConvert.DeserializeObject<SSMStructure>(result);
     return structure;
 }
Пример #2
0
        internal override async Task <string> Download(string secretId)
        {
            var request = new model.GetParameterRequest {
                Name = secretId
            };
            var response = await AwsClient.GetParameterAsync(request);

            return(response.Parameter.Value);
        }
Пример #3
0
        internal override async Task <string> Download(string secretId)
        {
            if (secretId.IsEmpty())
            {
                throw new ArgumentNullException(nameof(secretId));
            }

            var request = new model.GetParameterRequest {
                Name = secretId
            };
            var response = await AwsClient.GetParameterAsync(request);

            return(response.Parameter.Value);
        }
Пример #4
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SimpleSystemsManagement.Model.GetParameterRequest();

            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.WithDecryption != null)
            {
                request.WithDecryption = cmdletContext.WithDecryption.Value;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
Пример #5
0
 private Amazon.SimpleSystemsManagement.Model.GetParameterResponse CallAWSServiceOperation(IAmazonSimpleSystemsManagement client, Amazon.SimpleSystemsManagement.Model.GetParameterRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Systems Manager", "GetParameter");
     try
     {
         #if DESKTOP
         return(client.GetParameter(request));
         #elif CORECLR
         return(client.GetParameterAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }