Exemple #1
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public TransferDeviceClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "TRANSFERDEVICE",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://datatransfer.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Waiters = new TransferDeviceWaiters(this);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public AuditClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "AUDIT",
                ServiceEndpointPrefix   = "audit",
                ServiceEndpointTemplate = "https://audit.{region}.oraclecloud.com"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new AuditPaginators(this);
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public ResourceSearchClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "RESOURCESEARCH",
                ServiceEndpointPrefix   = "query",
                ServiceEndpointTemplate = "https://query.{region}.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new ResourceSearchPaginators(this);
        }
 public DefaultRequestSigner(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy, ISigner signer) : base(authDetailsProvider)
 {
     this.keyId  = authDetailsProvider.KeyId;
     this.signer = signer;
     this.signer.Init(true, authDetailsProvider.GetPrivateKey());
     this.signingStrategy = signingStrategy;
 }
Exemple #5
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public GenericArtifactsContentClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "GENERICARTIFACTSCONTENT",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://generic.{region}.ocir.io"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
        }
Exemple #6
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public RecipientInvitationClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName = "RECIPIENTINVITATION",
                ServiceEndpointPrefix = "",
                ServiceEndpointTemplate = "https://organizations.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new RecipientInvitationPaginators(this);
            Waiters = new RecipientInvitationWaiters(this);
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public OperatorActionsClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "OPERATORACTIONS",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://operator-access-control.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new OperatorActionsPaginators(this);
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public AIServiceLanguageClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "AISERVICELANGUAGE",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://language.aiservice.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
        }
Exemple #9
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public MarketplaceClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "MARKETPLACE",
                ServiceEndpointPrefix   = "marketplace",
                ServiceEndpointTemplate = "https://marketplace.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new MarketplacePaginators(this);
        }
Exemple #10
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public AnnouncementClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName           = "ANNOUNCEMENT",
                ServiceEndpointPrefix = "announcements"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new AnnouncementPaginators(this);
            Waiters    = new AnnouncementWaiters(this);
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public ComputeInstanceAgentClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "COMPUTEINSTANCEAGENT",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://iaas.{region}.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new ComputeInstanceAgentPaginators(this);
            Waiters    = new ComputeInstanceAgentWaiters(this);
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public AnalyticsClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "ANALYTICS",
                ServiceEndpointPrefix   = "",
                ServiceEndpointTemplate = "https://analytics.{region}.ocp.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new AnalyticsPaginators(this);
            Waiters    = new AnalyticsWaiters(this);
        }
Exemple #13
0
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public NotificationDataPlaneClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "NOTIFICATIONDATAPLANE",
                ServiceEndpointPrefix   = "notification",
                ServiceEndpointTemplate = "https://notification.{region}.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (authenticationDetailsProvider is IRegionProvider)
            {
                // Use region from Authentication details provider.
                SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
            }

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
            Paginators = new NotificationDataPlanePaginators(this);
            Waiters    = new NotificationDataPlaneWaiters(this);
        }
Exemple #14
0
        /**
         * Invoke a function.
         *
         * @param provider      the OCI credentials provider.
         * @param compartmentId the compartment in which to created the required
         *                      resources.
         * @param payload       the payload to be sent to the function on invocation.
         */
        private static async Task InvokeFunction(IBasicAuthenticationDetailsProvider provider, string compartmentId, string payload)
        {
            var fnManagementClient = new FunctionsManagementClient(provider);
            var fnInvokeClient     = new FunctionsInvokeClient(provider);

            try
            {
                // Invoke the function
                var fn = await GetUniqueFunctionByName(fnManagementClient, compartmentId);

                var response = await InvokeFunction(fnInvokeClient, fn, payload);

                if (response != null)
                {
                    logger.Info($"Response from function: {response}");
                }
            }
            catch (Exception e)
            {
                logger.Error($"Failed to invoke function: {e}");
            }
            finally
            {
                fnInvokeClient.Dispose();
                fnManagementClient.Dispose();
            }
        }
Exemple #15
0
        /**
         * Remove all resources created by the 'setup' operation.
         *
         * NB: Resources can only be removed 30 minutes after the last Function
         * invocation.
         *
         * @param provider      the OCI credentials provider.
         * @param region        the OCI region in which to create the required
         *                      resources.
         * @param compartmentId the compartment in which to created the required
         *                      resources.
         * @param name          a name prefix to easily identify the resources.
         */
        private static async Task TearDownResources(IBasicAuthenticationDetailsProvider provider, string compartmentId)
        {
            var identityClient     = new IdentityClient(provider);
            var vcnClient          = new VirtualNetworkClient(provider);
            var fnManagementClient = new FunctionsManagementClient(provider);

            try
            {
                logger.Info("Cleaning up....");

                var vcn = await GetUniqueVcnByName(vcnClient, compartmentId);

                var ig = await GetUniqueInternetGatewayByName(vcnClient, compartmentId, vcn.Id);

                var rt = await GetUniqueRouteTableByName(vcnClient, compartmentId, vcn.Id);

                var subnet = await GetUniqueSubnetByName(vcnClient, compartmentId, vcn.Id);

                var application = await GetUniqueApplicationByName(fnManagementClient, compartmentId);

                var fn = await GetUniqueFunctionByName(fnManagementClient, application.Id, FunctionName);

                if (fn != null)
                {
                    await DeleteFunction(fnManagementClient, fn.Id);
                }

                if (application != null)
                {
                    await DeleteApplication(fnManagementClient, application.Id);
                }

                if (ig != null)
                {
                    await ClearRouteRulesFromDefaultRouteTable(vcnClient, vcn.DefaultRouteTableId);
                    await DeleteInternetGateway(vcnClient, ig.Id);
                }

                if (subnet != null)
                {
                    await DeleteSubnet(vcnClient, subnet);
                }

                if (vcn != null)
                {
                    await DeleteVcn(vcnClient, vcn);
                }
            }
            catch (Exception e)
            {
                logger.Error($"Failed to clean the resources: {e}");
            }
            finally
            {
                fnManagementClient.Dispose();
                vcnClient.Dispose();
                identityClient.Dispose();
            }
        }
Exemple #16
0
        /// <summary> Constructor of a service client.</summary>
        /// <param name="authProvider">The authentication details provider.</param>
        /// <param name="clientConfiguration">A client configuration to customize client.</param>
        /// <param name="requestSigner">A request signer that will be used to sign requests.</param>
        public ClientBase(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration, RequestSigner requestSigner)
        {
            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            this.clientHandler           = new RestClientHandler(RequestReceptor);
            this.restClient              = new RestClient(clientHandler, clientConfigurationToUse);
            this.requestSigner           = requestSigner;
            this.availableRequestSigners = GetAvailableRequestSigners(authProvider);
            this.restClient.SetDefaultUserAgent(GetUserAgent(clientConfigurationToUse.ClientUserAgent));
        }
Exemple #17
0
        /**
         * Create all the OCI and Fn resources required to invoke a function.
         *
         * @param provider      the OCI credentials provider.
         * @param compartmentId the compartment in which to create the required
         *                      resources.
         * @param image         a valid OCI Registry image for the function.
         */
        private static async Task SetUpResources(IBasicAuthenticationDetailsProvider provider, string compartmentId, string image)
        {
            logger.Info("Setting up resources");

            var identityClient     = new IdentityClient(provider);
            var vcnClient          = new VirtualNetworkClient(provider);
            var fnManagementClient = new FunctionsManagementClient(provider);

            Vcn             vcn             = null;
            Subnet          subnet          = null;
            InternetGateway internetGateway = null;

            try
            {
                AvailabilityDomain availablityDomain = await GetAvailabilityDomain(identityClient, compartmentId);

                logger.Info($"availability domain is {availablityDomain.Name}");

                vcn = await CreateVcn(vcnClient, compartmentId);

                internetGateway = await CreateInternalGateway(vcnClient, compartmentId, vcn);
                await AddInternetGatewayToDefaultRouteTable(vcnClient, vcn.DefaultRouteTableId, internetGateway.Id);

                subnet = await CreateSubnet(vcnClient, compartmentId, availablityDomain.Name, vcn.Id);

                var subnetIds = new List <string>()
                {
                    subnet.Id
                };
                Application app = await CreateApplication(fnManagementClient, compartmentId, subnetIds);

                long     memoryInMBs      = 128L;
                int      timeoutInSeconds = 30;
                Function fn = await CreateFunction(fnManagementClient, app.Id, image, memoryInMBs, timeoutInSeconds);
            }
            catch (Exception e)
            {
                logger.Error($"failed to setup resources: {e}");
            }
            finally
            {
                fnManagementClient.Dispose();
                vcnClient.Dispose();
                identityClient.Dispose();
            }
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public KmsCryptoClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "KMSCRYPTO",
                ServiceEndpointPrefix   = "kms",
                ServiceEndpointTemplate = "https://kms.{region}.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
        }
        /// <summary>
        /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
        /// A client configuration can also be provided optionally to adjust REST client behaviors.
        /// </summary>
        /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
        /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
        /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
        public FunctionsInvokeClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
            : base(authenticationDetailsProvider, clientConfiguration)
        {
            service = new Service
            {
                ServiceName             = "FUNCTIONSINVOKE",
                ServiceEndpointPrefix   = "functions",
                ServiceEndpointTemplate = "https://functions.{region}.oci.{secondLevelDomain}"
            };

            ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();

            if (endpoint != null)
            {
                logger.Info($"Using endpoint specified \"{endpoint}\".");
                SetEndpoint(endpoint);
            }

            this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
        }
 public RegionalClientBase(IBasicAuthenticationDetailsProvider authProvider) : base(authProvider)
 {
 }
 public RegionalClientBase(IBasicAuthenticationDetailsProvider authProvider, RequestSigner requestSigner) : base(authProvider, requestSigner)
 {
 }
Exemple #22
0
        private Dictionary <SigningStrategy, RequestSigner> GetAvailableRequestSigners(IBasicAuthenticationDetailsProvider authProvider)
        {
            var signers = new Dictionary <SigningStrategy, RequestSigner>();

            foreach (SigningStrategy strategy in SigningStrategy.Values)
            {
                signers.Add(strategy, new DefaultRequestSigner(authProvider, strategy));
            }
            return(signers);
        }
        public static HttpClientHandler FromAuthProvider(IBasicAuthenticationDetailsProvider provider, SigningStrategy signingStrategy)
        {
            var requestSigner = new DefaultRequestSigner(provider, signingStrategy);

            return(FromRequestSigner(requestSigner));
        }
Exemple #24
0
 /// <summary> Constructor of a service client.</summary>
 /// <param name="authProvider">The authentication details provider.</param>
 /// <param name="requestSigner">A request signer that will be used to sign requests.</param>
 public ClientBase(IBasicAuthenticationDetailsProvider authProvider, RequestSigner requestSigner) :
     this(authProvider, new ClientConfiguration(), requestSigner)
 {
 }
Exemple #25
0
 /// <summary> Constructor of a service client.</summary>
 /// <param name="authProvider">The authentication details provider.</param>
 /// <param name="clientConfiguration">A client configuration to customize client.</param>
 public ClientBase(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration) :
     this(authProvider, clientConfiguration, new DefaultRequestSigner(authProvider))
 {
 }
 public RequestSigner(IBasicAuthenticationDetailsProvider authDetailsProvider)
 {
     AuthDetailsProvider = authDetailsProvider;
 }
 public RegionalClientBase(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration) : base(authProvider, clientConfiguration)
 {
 }
 public DefaultRequestSigner(IBasicAuthenticationDetailsProvider authDetailsProvider, ISigner signer) :
     this(authDetailsProvider, SigningStrategy.STANDARD, signer)
 {
 }
 public RegionalClientBase(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration, RequestSigner requestSigner) : base(authProvider, clientConfiguration, requestSigner)
 {
 }
 public DefaultRequestSigner(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy) :
     this(authDetailsProvider, signingStrategy, SignerUtilities.GetSigner("SHA-256withRSA"))
 {
 }