Esempio n. 1
0
 private Amazon.AppStream.Model.UpdateImagePermissionsResponse CallAWSServiceOperation(IAmazonAppStream client, Amazon.AppStream.Model.UpdateImagePermissionsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon AppStream", "UpdateImagePermissions");
     try
     {
         #if DESKTOP
         return(client.UpdateImagePermissions(request));
         #elif CORECLR
         return(client.UpdateImagePermissionsAsync(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;
     }
 }
Esempio n. 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AppStream.Model.UpdateImagePermissionsRequest();


            // populate ImagePermissions
            var requestImagePermissionsIsNull = true;

            request.ImagePermissions = new Amazon.AppStream.Model.ImagePermissions();
            System.Boolean?requestImagePermissions_imagePermissions_AllowFleet = null;
            if (cmdletContext.ImagePermissions_AllowFleet != null)
            {
                requestImagePermissions_imagePermissions_AllowFleet = cmdletContext.ImagePermissions_AllowFleet.Value;
            }
            if (requestImagePermissions_imagePermissions_AllowFleet != null)
            {
                request.ImagePermissions.AllowFleet = requestImagePermissions_imagePermissions_AllowFleet.Value;
                requestImagePermissionsIsNull       = false;
            }
            System.Boolean?requestImagePermissions_imagePermissions_AllowImageBuilder = null;
            if (cmdletContext.ImagePermissions_AllowImageBuilder != null)
            {
                requestImagePermissions_imagePermissions_AllowImageBuilder = cmdletContext.ImagePermissions_AllowImageBuilder.Value;
            }
            if (requestImagePermissions_imagePermissions_AllowImageBuilder != null)
            {
                request.ImagePermissions.AllowImageBuilder = requestImagePermissions_imagePermissions_AllowImageBuilder.Value;
                requestImagePermissionsIsNull = false;
            }
            // determine if request.ImagePermissions should be set to null
            if (requestImagePermissionsIsNull)
            {
                request.ImagePermissions = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.SharedAccountId != null)
            {
                request.SharedAccountId = cmdletContext.SharedAccountId;
            }

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