/// <summary>
        /// Creates a new service connector in the specified compartment.
        /// A service connector is a logically defined flow for moving data from
        /// a source service to a destination service in Oracle Cloud Infrastructure.
        /// For general information about service connectors, see
        /// [Service Connector Hub Overview](https://docs.cloud.oracle.com/iaas/Content/service-connector-hub/overview.htm).
        /// &lt;br/&gt;
        /// For purposes of access control, you must provide the
        /// [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment where
        /// you want the service connector to reside. Notice that the service connector
        /// doesn&#39;t have to be in the same compartment as the source or target services.
        /// For information about access control and compartments, see
        /// [Overview of the IAM Service](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/overview.htm).
        /// &lt;br/&gt;
        /// After you send your request, the new service connector&#39;s state is temporarily
        /// CREATING. When the state changes to ACTIVE, data begins transferring from the
        /// source service to the target service. For instructions on deactivating and
        /// activating service connectors, see
        /// [To activate or deactivate a service connector](https://docs.cloud.oracle.com/iaas/Content/service-connector-hub/overview.htm).
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/sch/CreateServiceConnector.cs.html">here</a> to see an example of how to use CreateServiceConnector API.</example>
        public async Task <CreateServiceConnectorResponse> CreateServiceConnector(CreateServiceConnectorRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called createServiceConnector");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/serviceConnectors".Trim('/')));
            HttpMethod         method         = new HttpMethod("POST");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <CreateServiceConnectorResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"CreateServiceConnector failed with error: {e.Message}");
                throw;
            }
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            CreateServiceConnectorRequest request;

            try
            {
                request = new CreateServiceConnectorRequest
                {
                    CreateServiceConnectorDetails = CreateServiceConnectorDetails,
                    OpcRetryToken = OpcRetryToken,
                    OpcRequestId  = OpcRequestId
                };

                response = client.CreateServiceConnector(request).GetAwaiter().GetResult();
                WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId));
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }