/// <summary>
        /// Returns the connection ARN and details such as status, owner, and provider type.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetConnection service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// 
        /// <returns>The response from the GetConnection service method, as returned by CodeStarconnections.</returns>
        /// <exception cref="Amazon.CodeStarconnections.Model.ResourceNotFoundException">
        /// Resource not found. Verify the connection resource ARN and try again.
        /// </exception>
        /// <exception cref="Amazon.CodeStarconnections.Model.ResourceUnavailableException">
        /// Resource not found. Verify the ARN for the host resource and try again.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codestar-connections-2019-12-01/GetConnection">REST API Reference for GetConnection Operation</seealso>
        public virtual Task<GetConnectionResponse> GetConnectionAsync(GetConnectionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetConnectionRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetConnectionResponseUnmarshaller.Instance;

            return InvokeAsync<GetConnectionResponse>(request, options, cancellationToken);
        }
        internal virtual GetConnectionResponse GetConnection(GetConnectionRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetConnectionRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetConnectionResponseUnmarshaller.Instance;

            return Invoke<GetConnectionResponse>(request, options);
        }
 public Handle_Returns
 (
     WebApplicationFactory <Startup> aWebApplicationFactory,
     JsonSerializerSettings aJsonSerializerSettings
 ) : base(aWebApplicationFactory, aJsonSerializerSettings)
 {
     GetConnectionRequest = CreateValidGetConnectionRequest();
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GetConnection operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetConnection operation on AmazonApiGatewayManagementApiClient.</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 EndGetConnection
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/apigatewaymanagementapi-2018-11-29/GetConnection">REST API Reference for GetConnection Operation</seealso>
        public virtual IAsyncResult BeginGetConnection(GetConnectionRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetConnectionRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetConnectionResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        /// <summary>
        /// Creates a waiter using the provided configuration.
        /// </summary>
        /// <param name="request">Request to send.</param>
        /// <param name="config">Wait Configuration</param>
        /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
        /// <returns>a new Oci.common.Waiter instance</returns>
        public Waiter <GetConnectionRequest, GetConnectionResponse> ForConnection(GetConnectionRequest request, WaiterConfiguration config, params LifecycleStates[] targetStates)
        {
            var agent = new WaiterAgent <GetConnectionRequest, GetConnectionResponse>(
                request,
                request => client.GetConnection(request),
                response => targetStates.Contains(response.Connection.LifecycleState.Value),
                targetStates.Contains(LifecycleStates.Deleted)
                );

            return(new Waiter <GetConnectionRequest, GetConnectionResponse>(config, agent));
        }
 /// <summary>Snippet for GetConnection</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConnectionRequestObject()
 {
     // Create client
     ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
     // Initialize request argument(s)
     GetConnectionRequest request = new GetConnectionRequest
     {
         ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
     };
     // Make the request
     Connection response = connectionServiceClient.GetConnection(request);
 }
Ejemplo n.º 7
0
        /// <summary>Snippet for GetConnectionAsync</summary>
        public async Task GetConnectionRequestObjectAsync()
        {
            // Snippet: GetConnectionAsync(GetConnectionRequest, CallSettings)
            // Additional: GetConnectionAsync(GetConnectionRequest, CancellationToken)
            // Create client
            ConnectionServiceClient connectionServiceClient = await ConnectionServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetConnectionRequest request = new GetConnectionRequest
            {
                ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
            };
            // Make the request
            Connection response = await connectionServiceClient.GetConnectionAsync(request);

            // End snippet
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Gets an existing APConnection by type and id.
        /// </summary>
        /// <param name="type">The type (relation name) of the connection.</param>
        /// <param name="id">The id of the connection.</param>
        /// <param name="options">Request specific api options. These will override the global settings for the app for this request.</param>
        /// <returns>The matching APConnection object.</returns>
        public async static Task <APConnection> GetAsync(string relation, string id, ApiOptions options = null)
        {
            var request = new GetConnectionRequest {
                Relation = relation, Id = id
            };

            ApiOptions.Apply(request, options);
            var response = await request.ExecuteAsync();

            if (response.Status.IsSuccessful == false)
            {
                throw response.Status.ToFault();
            }
            else
            {
                return(response.Connection);
            }
        }
Ejemplo n.º 9
0
 internal static void ValidateGetConnectionResponse(GetConnectionRequest aGetConnectionRequest, GetConnectionResponse aGetConnectionResponse)
 {
     aGetConnectionResponse.CorrelationId.Should().Be(aGetConnectionRequest.CorrelationId);
     aGetConnectionResponse.ConnectionRecord.Should().NotBeNull();
     aGetConnectionResponse.ConnectionRecord.Alias.Name.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.Alias.ImageUrl.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.CreatedAtUtc.HasValue.Should().BeTrue();
     aGetConnectionResponse.ConnectionRecord.Endpoint.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.MultiPartyInvitation.Should().BeFalse();
     aGetConnectionResponse.ConnectionRecord.Id.Should().Be(aGetConnectionRequest.ConnectionId);
     aGetConnectionResponse.ConnectionRecord.MyDid.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.MyVk.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.State.Should().Be(ConnectionState.Invited);
     aGetConnectionResponse.ConnectionRecord.TheirDid.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.TheirVk.Should().BeNull();
     aGetConnectionResponse.ConnectionRecord.TypeName.Should().Be("AF.ConnectionRecord");
     aGetConnectionResponse.ConnectionRecord.UpdatedAtUtc.HasValue.Should().BeFalse();
 }
        private void HandleOutput(GetConnectionRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

            switch (ParameterSetName)
            {
            case LifecycleStateParamSet:
                response = client.Waiters.ForConnection(request, waiterConfig, WaitForLifecycleState).Execute();
                break;

            case Default:
                response = client.GetConnection(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, response.Connection);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetConnectionRequest request;

            try
            {
                request = new GetConnectionRequest
                {
                    ConnectionId = ConnectionId,
                    OpcRequestId = OpcRequestId
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Ejemplo n.º 12
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetConnectionRequest request;

            try
            {
                request = new GetConnectionRequest
                {
                    WorkspaceId   = WorkspaceId,
                    ConnectionKey = ConnectionKey,
                    OpcRequestId  = OpcRequestId
                };

                response = client.GetConnection(request).GetAwaiter().GetResult();
                WriteOutput(response, response.Connection);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
 /// <summary>
 /// Creates a waiter using default wait configuration.
 /// </summary>
 /// <param name="request">Request to send.</param>
 /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
 /// <returns>a new Oci.common.Waiter instance</returns>
 public Waiter <GetConnectionRequest, GetConnectionResponse> ForConnection(GetConnectionRequest request, params LifecycleStates[] targetStates)
 {
     return(this.ForConnection(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates));
 }