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

            if (cmdletContext.DirectoryName != null)
            {
                request.DirectoryName = cmdletContext.DirectoryName;
            }
            if (cmdletContext.OrganizationalUnitDistinguishedName != null)
            {
                request.OrganizationalUnitDistinguishedNames = cmdletContext.OrganizationalUnitDistinguishedName;
            }

            // populate ServiceAccountCredentials
            var requestServiceAccountCredentialsIsNull = true;

            request.ServiceAccountCredentials = new Amazon.AppStream.Model.ServiceAccountCredentials();
            System.String requestServiceAccountCredentials_serviceAccountCredentials_AccountName = null;
            if (cmdletContext.ServiceAccountCredentials_AccountName != null)
            {
                requestServiceAccountCredentials_serviceAccountCredentials_AccountName = cmdletContext.ServiceAccountCredentials_AccountName;
            }
            if (requestServiceAccountCredentials_serviceAccountCredentials_AccountName != null)
            {
                request.ServiceAccountCredentials.AccountName = requestServiceAccountCredentials_serviceAccountCredentials_AccountName;
                requestServiceAccountCredentialsIsNull        = false;
            }
            System.String requestServiceAccountCredentials_serviceAccountCredentials_AccountPassword = null;
            if (cmdletContext.ServiceAccountCredentials_AccountPassword != null)
            {
                requestServiceAccountCredentials_serviceAccountCredentials_AccountPassword = cmdletContext.ServiceAccountCredentials_AccountPassword;
            }
            if (requestServiceAccountCredentials_serviceAccountCredentials_AccountPassword != null)
            {
                request.ServiceAccountCredentials.AccountPassword = requestServiceAccountCredentials_serviceAccountCredentials_AccountPassword;
                requestServiceAccountCredentialsIsNull            = false;
            }
            // determine if request.ServiceAccountCredentials should be set to null
            if (requestServiceAccountCredentialsIsNull)
            {
                request.ServiceAccountCredentials = null;
            }

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