Beispiel #1
0
 private Amazon.S3Control.Model.CreateAccessPointForObjectLambdaResponse CallAWSServiceOperation(IAmazonS3Control client, Amazon.S3Control.Model.CreateAccessPointForObjectLambdaRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon S3 Control", "CreateAccessPointForObjectLambda");
     try
     {
         #if DESKTOP
         return(client.CreateAccessPointForObjectLambda(request));
         #elif CORECLR
         return(client.CreateAccessPointForObjectLambdaAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3Control.Model.CreateAccessPointForObjectLambdaRequest();

            if (cmdletContext.AccountId != null)
            {
                request.AccountId = cmdletContext.AccountId;
            }

            // populate Configuration
            var requestConfigurationIsNull = true;

            request.Configuration = new Amazon.S3Control.Model.ObjectLambdaConfiguration();
            List <System.String> requestConfiguration_configuration_AllowedFeature = null;

            if (cmdletContext.Configuration_AllowedFeature != null)
            {
                requestConfiguration_configuration_AllowedFeature = cmdletContext.Configuration_AllowedFeature;
            }
            if (requestConfiguration_configuration_AllowedFeature != null)
            {
                request.Configuration.AllowedFeatures = requestConfiguration_configuration_AllowedFeature;
                requestConfigurationIsNull            = false;
            }
            System.Boolean?requestConfiguration_configuration_CloudWatchMetricsEnabled = null;
            if (cmdletContext.Configuration_CloudWatchMetricsEnabled != null)
            {
                requestConfiguration_configuration_CloudWatchMetricsEnabled = cmdletContext.Configuration_CloudWatchMetricsEnabled.Value;
            }
            if (requestConfiguration_configuration_CloudWatchMetricsEnabled != null)
            {
                request.Configuration.CloudWatchMetricsEnabled = requestConfiguration_configuration_CloudWatchMetricsEnabled.Value;
                requestConfigurationIsNull = false;
            }
            System.String requestConfiguration_configuration_SupportingAccessPoint = null;
            if (cmdletContext.Configuration_SupportingAccessPoint != null)
            {
                requestConfiguration_configuration_SupportingAccessPoint = cmdletContext.Configuration_SupportingAccessPoint;
            }
            if (requestConfiguration_configuration_SupportingAccessPoint != null)
            {
                request.Configuration.SupportingAccessPoint = requestConfiguration_configuration_SupportingAccessPoint;
                requestConfigurationIsNull = false;
            }
            List <Amazon.S3Control.Model.ObjectLambdaTransformationConfiguration> requestConfiguration_configuration_TransformationConfiguration = null;

            if (cmdletContext.Configuration_TransformationConfiguration != null)
            {
                requestConfiguration_configuration_TransformationConfiguration = cmdletContext.Configuration_TransformationConfiguration;
            }
            if (requestConfiguration_configuration_TransformationConfiguration != null)
            {
                request.Configuration.TransformationConfigurations = requestConfiguration_configuration_TransformationConfiguration;
                requestConfigurationIsNull = false;
            }
            // determine if request.Configuration should be set to null
            if (requestConfigurationIsNull)
            {
                request.Configuration = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            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);
        }