Container for the parameters to the ConnectDirectory operation. Creates an AD Connector to connect to an on-premises directory.

Before you call ConnectDirectory, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the ConnectDirectory operation, see AWS Directory Service API Permissions: Actions, Resources, and Conditions Reference.

Inheritance: AmazonDirectoryServiceRequest
        /// <summary>
        /// Initiates the asynchronous execution of the ConnectDirectory operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ConnectDirectory operation on AmazonDirectoryServiceClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndConnectDirectory
        ///         operation.</returns>
        public IAsyncResult BeginConnectDirectory(ConnectDirectoryRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new ConnectDirectoryRequestMarshaller();
            var unmarshaller = ConnectDirectoryResponseUnmarshaller.Instance;

            return BeginInvoke<ConnectDirectoryRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Creates an AD Connector to connect to an on-premises directory.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ConnectDirectory service method.</param>
        /// 
        /// <returns>The response from the ConnectDirectory service method, as returned by DirectoryService.</returns>
        /// <exception cref="Amazon.DirectoryService.Model.ClientException">
        /// A client exception has occurred.
        /// </exception>
        /// <exception cref="Amazon.DirectoryService.Model.DirectoryLimitExceededException">
        /// The maximum number of directories in the region has been reached. You can use the
        /// <a>GetDirectoryLimits</a> operation to determine your directory limits in the region.
        /// </exception>
        /// <exception cref="Amazon.DirectoryService.Model.InvalidParameterException">
        /// One or more parameters are not valid.
        /// </exception>
        /// <exception cref="Amazon.DirectoryService.Model.ServiceException">
        /// An exception has occurred in AWS Directory Service.
        /// </exception>
        public ConnectDirectoryResponse ConnectDirectory(ConnectDirectoryRequest request)
        {
            var marshaller = new ConnectDirectoryRequestMarshaller();
            var unmarshaller = ConnectDirectoryResponseUnmarshaller.Instance;

            return Invoke<ConnectDirectoryRequest,ConnectDirectoryResponse>(request, marshaller, unmarshaller);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.DirectoryService.Model.ConnectDirectoryRequest();


            // populate ConnectSettings
            var requestConnectSettingsIsNull = true;

            request.ConnectSettings = new Amazon.DirectoryService.Model.DirectoryConnectSettings();
            List <System.String> requestConnectSettings_connectSettings_CustomerDnsIp = null;

            if (cmdletContext.ConnectSettings_CustomerDnsIp != null)
            {
                requestConnectSettings_connectSettings_CustomerDnsIp = cmdletContext.ConnectSettings_CustomerDnsIp;
            }
            if (requestConnectSettings_connectSettings_CustomerDnsIp != null)
            {
                request.ConnectSettings.CustomerDnsIps = requestConnectSettings_connectSettings_CustomerDnsIp;
                requestConnectSettingsIsNull           = false;
            }
            System.String requestConnectSettings_connectSettings_CustomerUserName = null;
            if (cmdletContext.ConnectSettings_CustomerUserName != null)
            {
                requestConnectSettings_connectSettings_CustomerUserName = cmdletContext.ConnectSettings_CustomerUserName;
            }
            if (requestConnectSettings_connectSettings_CustomerUserName != null)
            {
                request.ConnectSettings.CustomerUserName = requestConnectSettings_connectSettings_CustomerUserName;
                requestConnectSettingsIsNull             = false;
            }
            List <System.String> requestConnectSettings_connectSettings_SubnetId = null;

            if (cmdletContext.ConnectSettings_SubnetId != null)
            {
                requestConnectSettings_connectSettings_SubnetId = cmdletContext.ConnectSettings_SubnetId;
            }
            if (requestConnectSettings_connectSettings_SubnetId != null)
            {
                request.ConnectSettings.SubnetIds = requestConnectSettings_connectSettings_SubnetId;
                requestConnectSettingsIsNull      = false;
            }
            System.String requestConnectSettings_connectSettings_VpcId = null;
            if (cmdletContext.ConnectSettings_VpcId != null)
            {
                requestConnectSettings_connectSettings_VpcId = cmdletContext.ConnectSettings_VpcId;
            }
            if (requestConnectSettings_connectSettings_VpcId != null)
            {
                request.ConnectSettings.VpcId = requestConnectSettings_connectSettings_VpcId;
                requestConnectSettingsIsNull  = false;
            }
            // determine if request.ConnectSettings should be set to null
            if (requestConnectSettingsIsNull)
            {
                request.ConnectSettings = null;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Password != null)
            {
                request.Password = cmdletContext.Password;
            }
            if (cmdletContext.ShortName != null)
            {
                request.ShortName = cmdletContext.ShortName;
            }
            if (cmdletContext.Size != null)
            {
                request.Size = cmdletContext.Size;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }
 private Amazon.DirectoryService.Model.ConnectDirectoryResponse CallAWSServiceOperation(IAmazonDirectoryService client, Amazon.DirectoryService.Model.ConnectDirectoryRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Directory Service", "ConnectDirectory");
     try
     {
         #if DESKTOP
         return(client.ConnectDirectory(request));
         #elif CORECLR
         return(client.ConnectDirectoryAsync(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;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the ConnectDirectory operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ConnectDirectory operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<ConnectDirectoryResponse> ConnectDirectoryAsync(ConnectDirectoryRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ConnectDirectoryRequestMarshaller();
            var unmarshaller = ConnectDirectoryResponseUnmarshaller.Instance;

            return InvokeAsync<ConnectDirectoryRequest,ConnectDirectoryResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }