Giter Site home page Giter Site logo

oracle / oci-dotnet-sdk Goto Github PK

View Code? Open in Web Editor NEW
47.0 19.0 20.0 37.9 MB

Oracle Cloud Infrastructure SDK for .NET

Home Page: https://cloud.oracle.com/cloud-infrastructure

License: Other

C# 100.00% Makefile 0.01%
csharp dotnet sdk oracle-cloud oracle-cloud-infrastructure cloud oracle

oci-dotnet-sdk's Introduction

Oracle Cloud Infrastructure SDK for .NET

About

The oci-dotnet-sdk provides an SDK for .NET that you can use to manage your Oracle Cloud Infrastructure resources.

The project is open source and maintained by Oracle Corp.

Dependencies

SDK Organization

The oci-dotnet-sdk contain the following 3 groups of packages:

  • Common package: Found in the Common and Commontests (unit tests for common package) directories. The common package provides supporting classes and methods used by service packages. It includes HTTP request/response (de)serialization, request signing, JSON parsing, and other helper functions. Most of the functions in this package are meant to be used by the service packages.
  • Examples package: Found in the Examples directory. It includes some working examples on how to use oci-dotnet-sdk to manage Oracle Cloud Infrastracture resources.
  • Service packages: All packages except Common, Commontests, and Examples. These packages represent the Oracle Cloud Infrastructure services supported by the .NET SDK. Each package represents a service. These packages include the service client(s) with methods to interact with the service, classes for the requests, responses, and input and output parameters.

Install Packages

The SDK is published as Nuget packages.

Use either dotnet CLI or Visual Studio to install and consume a package from nuget.org.

  • dotnet CLI:
dotnet add package <PACKAGE_ID> --version <VERSION> (If version not specified then it pulls the latest version)

Example:
dotnet add package OCI.DotNetSDK.Core (Installs the latest version of the Core Service package)
dotnet add package OCI.DotNetSDK.Identity -v 1.0.0 (Installs version 1.0.0 of the Identity Service package)

NOTE: To avoid dependency conflicts, you should use the same versions of all OCI .NET SDK Nuget packages within an application.
  • Visual Studio: Right-click a project and select "Manage Nuget Packages" and then search for the package name and version number to install.

Documentation

Public documentation and API Reference for the sdk can be found here.

Working with the .NET SDK

To start working with oci-dotnet-sdk, you need to create a .NET project, install packages, create a client, and then use that client to send requests to service endpoint.

Configuring

Before using the SDK, set up a config file with the required credentials. See SDK and Tool Configuration for instructions.

Creating Client

To create a service client, you need to set up the client to use the credentials. Check here on how to configure it.

Example that shows creating the Audit Service client using ConfigFileAuthenticationDetailsProvider Class for configuring credentials:

var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
var client = new AuditClient(provider, new ClientConfiguration());

Sending Request

To send a request to an Oracle Cloud Infrastructure service endpoint, build a request object and send it using the client created above.

var listEventsRequest = new ListEventsRequest
{
    // Assumption: the compartment id has been set in environment variable.
    CompartmentId = compartmentId,
    StartTime = DateTime.Now.AddDays(-1),
    EndTime = DateTime.Now
};

try
{
    var response = await client.ListEvents(listEventsRequest);
}
catch (Exception e)
{
    // Handle the exception.
}

Enable Logging

NLog package is used for logging in .NET projects. This package gets auto-installed as a dependency when you install OCI .NET SDK package. In order to view .NET SDK logs, you will need to:

  • Add NLog.config file at the project root directory. A sample NLog.config file can be found here.
  • Add ItemGroup section in the project file:
<ItemGroup>
     <Content Include="PATH TO NLog.config File" >
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
</ItemGroup>
  • To enable logging in user application, create a logger:
var logger = NLog.LogManager.GetCurrentClassLogger();
logger.Info("Hello World");

NOTE

Only SDK logging will be captured if logger is not created in user application.


Examples

Examples can be found here.

Examples for all supported services can be found at the API reference under their respective reference doc.

To use the example code: copy the sample, change the parameter values to values that make sense for your use case (ex: OCI instance ID with your OCI instance ID), and then you can run the code to have a working automation against OCI.

Building and Testing

Build

Building the SDK can be done at the root of the whole solution or at individual project level under it. At the root level, to build the whole solution, run with dotnet cli command:

dotnet build

or use the included Makefile:

make build

The Makefile also provides an option to build individal projects from the root level:

make build PROJECT_PATH=Common

Alternatively, individual project and be built using dotnet cli inside project directory.

Test

The common package has corresponding unit tests. These tests can be run using dotnet cli command or through Makefile. To run the unit tests from the root, a test filter needs to be provided:

dotnet test --filter Category=Unit

Alternatively, running tests inside common_tests project does not require the filter. To run tests using Makefile:

make unit-test

Help

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

Security

Please consult the security guide for our responsible security vulnerability disclosure process

License

Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.

This SDK is dual licensed under the Universal Permissive License 1.0 and the Apache License 2.0.

See LICENSE for more details.

Changes

See CHANGELOG

Known Issues

You can find information on any known issues with the SDK at Oracle Cloud Infrastructure Known Issues and under the Issues tab of this project's GitHub repository.

oci-dotnet-sdk's People

Contributors

bhagwatvyas avatar buzhidao77 avatar github-anurag avatar joshunter avatar oci-dex-release-bot avatar spavlusieva avatar varunmankal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oci-dotnet-sdk's Issues

No version bump for DLLs

Nuget package version was upgraded however the file version and production version of shipped DLL was not changed (always with 1.0.0.0)
image

CimsService / Support Management API - SSL failure, remote certificate invalid

Hi,

I've just been looking to extract OCI CSI support data for management reporting. Code is setup as per the example, yet I'm getting the following back - from both uk-london-1 and us-phoenix-1 region settings.

I am passing in our CSI, customer root tenancyId, tried 2 homeregions (API documentation only lists 2 US sites?), my user OCID.

System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch
at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
at Oci.Common.Http.RestClient.HttpSend(HttpRequestMessage httpRequest, CancellationToken cancellationToken)
at Oci.Common.Retry.GenericRetrier.<>c__DisplayClass3_0.<b__4>d.MoveNext()
--- End of stack trace from previous location ---
at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Func5 onRetryAsync, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider, Boolean continueOnCapturedContext) at Polly.AsyncPolicy1.ExecuteAsync(Func3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext) at Polly.Wrap.AsyncPolicyWrapEngine.<>c__DisplayClass2_01.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Polly.Timeout.AsyncTimeoutEngine.ImplementationAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, Func2 timeoutProvider, TimeoutStrategy timeoutStrategy, Func5 onTimeoutAsync, Boolean continueOnCapturedContext) at Polly.Timeout.AsyncTimeoutEngine.ImplementationAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, Func2 timeoutProvider, TimeoutStrategy timeoutStrategy, Func5 onTimeoutAsync, Boolean continueOnCapturedContext)
at Polly.AsyncPolicy.ExecuteAsync[TResult](Func3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext) at Polly.Wrap.AsyncPolicyWrapEngine.ImplementationAsync[TResult](Func3 func, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext, IAsyncPolicy outerPolicy, IAsyncPolicy1 innerPolicy) at Polly.AsyncPolicy1.ExecuteAsync(Func3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext) at Oci.CimsService.IncidentClient.ListIncidents(ListIncidentsRequest request, RetryConfiguration retryConfiguration, CancellationToken cancellationToken) at Oci.Common.Utils.ResponseEnumerable2.GetNextPageResponseAsync(String nextPageToken)
at Oci.Common.Utils.ResponseEnumerable`2.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of inner exception stack trace ---

Getting Bucket Size

When calling BucketGet via SDK or CLI, ApproximateCount and ApproximateSize are always both null.

Looking at Metrics Explorer, I can select a compartment, select oci_objectstorage, choose a bucket, and can see bucketsize.

Going in via MonitoringClient SDK, passing in oci_objectstorage, and filters "resourceId" and the OCID of the bucket, the compartment etc... returns only details of the filters, and no actual data.
Then I queried via CLI "oci monitoring metric list --compartment-id ***" to get a list of metrics in the compartment, and there is nothing for bucket size, StoredBytes etc?

Is the console display rendering bucketsize from some other source, not in the metrics? Either way, is there an SDK way to get the bucket size? The auto-generated code examples are incredibly generic, so not providing useful insight.

Nonseekable stream can not be uploaded to Object storage

The following code will throw an exception that
Oci.Common.Model.OciException
HResult=0x80131500
Message=v2-chunked-transfer-encoding
Source=OCI.DotNetSDK.Common
StackTrace:
at Oci.Common.Http.Internal.ResponseHelper.HandleNonSuccessfulResponse(HttpResponseMessage responseMessage, ApiDetails apiDetails, String caller)
at Oci.Common.Http.RestClient.CheckHttpResponseMessage(HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, ApiDetails apiDetails)
at Oci.ObjectstorageService.ObjectStorageClient.d__48.MoveNext()
at Program.<

$>d__0.MoveNext() in D:\code\localtest\OraclePlayground\Program.cs:line 37

  • NonseekableStream
internal class NonseekableStream : Stream
    {
        private Stream innerStream;

        public NonseekableStream(Stream innerStream)
        {
            this.innerStream = innerStream;
        }

        public override bool CanRead => innerStream.CanRead;

        public override bool CanSeek => false;

        public override bool CanWrite => false;

        public override long Length => innerStream.Length;

        public override long Position { get => innerStream.Position; set => throw new NotSupportedException(); }

        public override void Flush()
        {
            throw new NotSupportedException();
        }

        public override int Read(byte[] buffer, int offset, int count)
        {
            return innerStream.Read(buffer, offset, count);
        }

        public override long Seek(long offset, SeekOrigin origin)
        {
            throw new NotSupportedException();
        }

        public override void SetLength(long value)
        {
            throw new NotSupportedException();
        }

        public override void Write(byte[] buffer, int offset, int count)
        {
            throw new NotSupportedException();
        }
    }
  • Main code
var objectStorageClient = new ObjectStorageClient(provider);
var uri = objectStorageClient.GetEndpoint();
var bucketResponse = await objectStorageClient.GetBucket(new GetBucketRequest()
{
    NamespaceName = "ax1hhmmvkvpo",
    BucketName = "jefftest"
});
var bucket = bucketResponse.Bucket;
var putObjectResponse = await objectStorageClient.PutObject(new PutObjectRequest()
{
    NamespaceName = "ax1hhkmvkvpo",
    BucketName = "jefftest",
    PutObjectBody = new NonseekableStream(new MemoryStream(Encoding.UTF8.GetBytes("Hello, World2!"))),
    ObjectName = "test.txt",

});

Identity Domains, where are Applications?

Hi, I've setup a new tenancy with domains, and have setup application entries under a domain, so external web applications can use domain authentication with 2FA.

I can't see in the SDK or the CLI how to access domain\applications anywhere? Has this functionality been ported over from the IDCS APIs?

Missing OkeWorkloadIdentityAuthenticationDetailsProvider

Hi, correct me if I am wrong, but dotnet sdk is missing function "OkeWorkloadIdentityAuthenticationDetailsProvider" in auth library. It does exist in go and java sdks...

Does that mean that dotnet sdk do not support OKE workload identity auth ?

T.

LogAnalytics - ListScheduledTasks - Enum parameter issue

Hi,
I'm calling ListScheduledTasks which has 3 parameters. CompartmentId, NamespaceName, and TaskType.
TaskType is LA Enum TaskType, with a set of values.
I'm coding it to enumerate the values, so that it accomodates future changes.

var types = Enum.GetValues(typeof(TaskType)).Cast();
// this returns a list of TaskTypes to process in a foreach loop.
The TaskType values are:
UnknownEnumValue
SavedSearch
Acceleration
Purge
AccelerationMaintenance

Passing in UnknownEnumValue causes an ArgumentNullException error, so I've set that to skip..

When it gets to AccelerationMaintenance, it is passing in ACCELERATION_MAINTENANCE and taskType is invalid. The same error occurs via the CLI - so this is an API level error...

oci log-analytics scheduled-task list --namespace-name --compartment-id ocid1.compartment.oc1..**** --task-type ACCELERATION_MAINTENANCE --profile SSCL

yet the CLI outputs that as one of the approved values

OrganizationsClient -> ListOrganizations (rootId), stuck when listing All

Hi, pulling via latest SDK, OrganizationsClient -> ListOrganizations(rootId). In the SDK, calling via the client paginator, it just hangs and is in some loop.

Via the CLI, without the "-all" flag, it returns a single record without problem.

Via both the SDK paginator and the CLI with "-all" flag, the API hangs and does not respond, seemingly in a loop.

OVCP ListEsxiHostsRequest fails with invalid params

Apparently ListEsxiHostsRequest has no mandatory parameters, but fails when no parameters are passed in.
Can the documentation be updated to reflect the error output, so neither is mandatory, but one of the 2 params is required.

This fails in both dotnet SDK and CLI.
C#
public IEnumerable ListEsxiHosts()
{
var request = new ListEsxiHostsRequest();
var response = _esxiHostClient.Paginators.ListEsxiHostsResponseEnumerator(request);
return response.SelectMany(r => r.EsxiHostCollection.Items).ToList();
}

Error returned by EsxiHost Service. Http Status Code: 400. ServiceCode: InvalidParameter. OpcRequestId: /EBA878A1DB2ED241F5C46A1FE0BEBC76/464FDFA6668A06F8901F9FE4A2431941. Message: Invalid either sddcId or computeInstanceId should be specified
Operation Name: ListEsxiHosts

CLI
oci ocvs esxi-host list --profile ****

Key pair error

Hello!

I'm trying to run the example project, but I keep getting the following error:

2020-12-31 00:55:44.5227|INFO|Oci.Examples.AuditExample|Starting example
2020-12-31 00:55:44.6146|INFO|Oci.Examples.AuditExample|
2020-12-31 00:55:44.6892|INFO|Oci.Common.ConfigFileReader|Loading config file from: C:\Users\Gustavo.oci\config
2020-12-31 00:55:46.3067|INFO|Oci.Common.Auth.ConfigFileAuthenticationDetailsProvider|Choosing Configuration authentication details provider
2020-12-31 00:55:49.3509|ERROR|Oci.Examples.AuditExample|Failed Audit example: Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters' to type 'Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair'.

I have generated the config file according to the documentation in Oracle's site. What am I missing?

Thank you!

ObjectSorage Sample

I'm trying to use ObjectStorageExample,cs , but running the code I always get the following error even if the namespace and other settings seem ok:
PutObject failed with error: The namespace ({namespacename}) must be only upper and lower case letters, numbers, dashes, underscores and periods

Here the code setting bucket parameters:
image

Any idea of what I'm doing wrong ?
Thanks,
Paolo.

LogAnalytics - ListLabelPriorities - conversion failure

Hi, as part of my audit tooling, I've been extending it into the LA service as we launch them.
calling ListLabelPriorities is failing at the output level, before any form of JSON conversion etc.

Both calls fail:
var request = new ListLabelPrioritiesRequest() { NamespaceName = namespaceName };

call type 1
var response = _client.Paginators.ListLabelPrioritiesResponseEnumerator(request);
call type 2
var response = _client.ListLabelPriorities(request);

So code does not pass beyond either of those call formats.

Inner Exception 2:
JsonSerializationException: Error converting value "NONE" to type 'Oci.LoganalyticsService.Models.LabelPriority'. Path 'items[0]', line 1, position 16.

Inner Exception 3:
ArgumentException: Could not cast or convert from System.String to Oci.LoganalyticsService.Models.LabelPriority.


via CLI
oci log-analytics label list-label-priorities --namespace-name --profile

returns ...
{
"data": {
"items": [
{
"priority": null
},
{
"priority": null
},
{
"priority": null
},
{
"priority": null
}
]
}
}

Cost and Usage Reports Overview

Is there a nuget within the OCI SDK that has the responsibility of handling OCI cloud service cost and usage data? I need to treat and do calculation geared towards FinOps and; therefore, the need for an SDK aimed at this segment arose; but I'm not sure if the OCI SDK.DotNetSDK.Usage solves this problem.

Is LoadBalancer.ListListeners a missing method?

I'm just pulling lower content out of the Load Balancers to make it easier to then query & report, rather than having to traverse the complex JSON output of the object.

There is a ListListenerRules method with required parameters "LoadBalancerId" and "ListenerName", but there is no method to "ListListeners" (presumably by LoadBalancerId?

In C# I'm able to enumerate LoadBalancers, then process the Listeners property collection, just for most child objects there is an explicit method, rather than routing via the LB object.

I've looked in the CLI and it is the same setup, so not an API reference missed.

Usageapi - query single days costs - date format precision issue

Hi,
I'm looking to pull costs for a single compartment for 1 day, to see what the output is, and then look at tuning to get a specific set of costs.
Following the example code posted, passing in datetimes via DateTime.Parse, I get datetime precision errors.

TimeUsageStarted = DateTime.Parse("2021 JUL 21 00:00:00")
TimeUsageEnded = DateTime.Parse(2021 JUL 21 23:59:59")

These come out as valid DateTime objects, but when passed in to DTS/DTE the precision error arises.

Do you have an example lean query (ie without every single possible parameter/option, just the required ones) to output the costs for a compartment or tenant for a day? From that wide starter I can then filter down to compute, storage etc, and tag grouping.

Thanks, Justin.

Cannot utilize 'using' on ClientBase type variable

The ClientBase class has Dispose method but does not implement IDisposable interface, so C# compiler does not allow to utilize 'using' statement for ClientBase variables:

public abstract class ClientBase
{
private readonly Dictionary<SigningStrategy, RequestSigner> availableRequestSigners;
private readonly RequestSigner requestSigner;
protected static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
protected RestClientHandler clientHandler;
protected readonly RestClient restClient;
protected Service service;
protected string userAgent = null;
/// <summary> Constructor of a service client.</summary>
/// <param name="authProvider">The authentication details provider.</param>
public ClientBase(IBasicAuthenticationDetailsProvider authProvider) : this(authProvider,
new ClientConfiguration(), new DefaultRequestSigner(authProvider))
{ }
/// <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)
{ }
/// <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, new ClientConfiguration(), new DefaultRequestSigner(authProvider))
{ }
/// <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)
{
this.clientHandler = new RestClientHandler(RequestReceptor);
this.restClient = new RestClient(clientHandler, clientConfiguration);
this.requestSigner = requestSigner;
this.availableRequestSigners = GetAvailableRequestSigners(authProvider);
this.restClient.SetDefaultUserAgent(GetUserAgent(clientConfiguration.ClientUserAgent));
}
/// <summary>Disposes the rest client.</summary>
public void Dispose()
{
this.restClient.Dispose();
}

KeymanagementService - ListKeys - No baseUri/endpoint parameter

I'm trying to load keys out via ListKeys. I'm passing in the Compartment Id.
The output is an error "Value cannot be null. Parameter 'baseUri'. This does not exist in the C# SDK definitions or methods.

From testing in the CLI, it specifies passing in the --endpoint variable (CryptoEndpoint property in Vault) from the parent Vault, so I would expect to ListVaults, enumerate the vaults and call ListKeys for each one passing in Compartment & Endpoint parameter.

PrivateKeySupplier missing support for AsymmetricKeyParameter

After creating a private key for my user I downloaded the PEM file and initialized the FilePrivateKeySupplier with it and everything worked.
Now I store the content encrypted in my DB and get the content on runtime and want to use it with PrivateKeySupplier.
For some reason the PrivateKeySupplier assumes the key is AsymmetricCipherKeyPair and doesn't support the AsymmetricKeyParameter option like the FilePrivateKeySupplier.
Fixing it can be relatively easy, move the code from FilePrivateKeySupplier to PrivateKeySupplier and make FilePrivateKeySupplier inherit from PrivateKeySupplier

This is the code that can be moved to PrivateKeySupplier

var obj = new PemReader((TextReader) new StringReader(this.privateKeyContent), this.passPhrase == null ? (IPasswordFinder) null : (IPasswordFinder) new PasswordFinder(this.passPhrase)).ReadObject();
switch (obj)
{
    case AsymmetricCipherKeyPair _:
        return this.privateKey = (RsaKeyParameters) ((AsymmetricCipherKeyPair) obj).Private;
    case AsymmetricKeyParameter _:
        RsaPrivateCrtKeyParameters crtKeyParameters = (RsaPrivateCrtKeyParameters) obj;
        return this.privateKey = new RsaKeyParameters(crtKeyParameters.IsPrivate, crtKeyParameters.Modulus, crtKeyParameters.Exponent);
    default:
        throw new FormatException("The given key does not have the expected type");
}

Do you agree with the change?
I can make a PR if you do

Thanks

Performance regression in versions 14.2.0 to 22.0.0 for some services (fixed in v23.0.0)

In versions 14.2.0 to 22.0.0, you may encounter performance regressions when using the SDK with some OCI services. This issue has been fixed in v23.0.0 and later versions.

The regression surfaces itself as a 1-second increase in latency in SDK operations made to some OCI services. This issue has been confirmed to impact the OCI Streaming service, and likely impacts the Email Delivery, Health Checks, NoSQL Database Cloud, Registry, Generic Artifacts, and Web Application Acceleration and Security services as well. This list is not comprehensive โ€“ it is possible you may encounter the issue against other OCI services as well. The issue has been confirmed to NOT affect the OCI Object Storage and Functions services.

If you are experiencing this issue there are some workarounds you can do:

  • Use SDK version 14.1.0 or earlier, or version 23.0.0 later
  • Or, use the SDK's raw request signer to make requests to OCI services for any requests where you are experiencing performance degradation. An example on how to use the raw request signer is here

httpResponseMessage in Responses in version 85.1.0

I have been using the Oci.DotnetSDK version 78.2.0, and there was no โ€˜httpResponseMessageโ€™ in the responses (for example, CancelProcessorJobResponse). However, after updating the SDK to version 85.1.0, I noticed an additional property named โ€˜httpResponseMessageโ€™ in the response. This property is not currently useful to me.

Is there an option to hide or remove this property from the response?

Invalid queries created in .Net Framework projects

Steps to reproduce.

Create new Console App (.NET Framework) project, add following code to Main method:

var computeClient = new ComputeClient(new ConfigFileAuthenticationDetailsProvider("DEFAULT"), new ClientConfiguration());
var listShapesRequest = new ListShapesRequest
{
	CompartmentId = "compartment_id_here",
	AvailabilityDomain = "AD_name_here"
};
ListShapesResponse listShapesResponse = computeClient.ListShapes(listShapesRequest).Result;

Example fails with OciException: "Missing compartmentId"

HttpUtils.BuildQueryString Creates query string with starting "?", see

var sb = new StringBuilder("?");

This works fine in dotnet core, but fails in .Net Framework. It seems like System.UriBuilder.Query string setter works differently in dotnet core, see
https://github.com/dotnet/runtime/blob/6072e4d3a7a2a1493f514cdf4be75a3d56580e84/src/libraries/System.Private.Uri/src/System/UriBuilder.cs#L278
and .Net Framework, see
https://github.com/microsoft/referencesource/blob/a7bd3242bd7732dec4aebb21fbc0f6de61c2545e/System/net/System/uribuilder.cs#L277

How to get the Url of a storage object?

I'm storing some objects, but in the put and get of an object I didn't find any way in the documentation to return the url, I'm having to assemble it manually, how can I return the url?

string url = $"https://objectstorage.{Environment.GetEnvironmentVariable("OCI_REGION_ID")}" +
                $".oraclecloud.com/n/{Environment.GetEnvironmentVariable("NAMESPACE_NAME")}" +
                $"/b/{Environment.GetEnvironmentVariable("BUCKET_NAME")}/o/projects/{url}"

Storage Object List Fields

Hi.
I'm trying to list objects using dotnet sdk.
I need the md5 and the date of the object.
The "Fields" on the ObjectListRequest may do the job, but it is a single Enum.
How can I get all fields at same time?

Enum code from ListObjectsRequest.cs

public enum FieldsEnum {
            [EnumMember(Value = "name")]
            Name,
            [EnumMember(Value = "size")]
            Size,
            [EnumMember(Value = "etag")]
            Etag,
            [EnumMember(Value = "timeCreated")]
            TimeCreated,
            [EnumMember(Value = "md5")]
            Md5,
            [EnumMember(Value = "timeModified")]
            TimeModified,
            [EnumMember(Value = "storageTier")]
            StorageTier,
            [EnumMember(Value = "archivalState")]
            ArchivalState
        };

Fields property from same file

        /// 
        /// Object summary by default includes only the 'name' field. Use this parameter to also
        /// include 'size' (object size in bytes), 'etag', 'md5', 'timeCreated' (object creation date and time),
        /// 'timeModified' (object modification date and time), 'storageTier' and 'archivalState' fields.
        /// Specify the value of this parameter as a comma-separated, case-insensitive list of those field names. 
        /// For example 'name,etag,timeCreated,md5,timeModified,storageTier,archivalState'.
        /// 
        /// 
        [Oci.Common.Http.HttpConverter(Oci.Common.Http.TargetEnum.Query, "fields")]
        public System.Nullable Fields { get; set; }

Datasafe - ListAlertPolicies

Hi,
in calling the Datasafe ListAlertPolicies via the following code, it fails upon trying to return objects, before getting to my processing code...

function code:
var request = new ListAlertPoliciesRequest() { CompartmentId = compartmentId };
var responseEnum = _client.Paginators.ListAlertPoliciesResponseEnumerator(request);
return responseEnum.SelectMany(r => r.AlertPolicyCollection.Items).ToList();

The last line fails with the following error - this syntax is used for hundreds of OCI API calls.

JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Oci.DatasafeService.Models.AlertPolicyCollection' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.

In the OCI CLI, same tenancy/compartment, via oci data-safe alert-policy list --compartment-id **** --profile ****
I get an empty object returned, no error

{
"data": {
"items": null
}
}

Calling GetSecretBundleByName from behind a proxy

I am doing a code to call GetSecretBundleByName, code is working fine from my local system, but not able to make calls if machine is behind proxy.

With Ruby I can do this like
proxy_setting = OCI::ApiClientProxySettings.new("HOST", PORT)
config = OCI::ConfigFileLoader.load_config(config_file_location: "D:\config", profile_name: 'DEFAULT')
secrets_client = OCI::Secrets::SecretsClient.new(config: config, proxy_settings: proxy_setting)
get_secret_bundle_by_name_response = secrets_client.get_secret_bundle_by_name( ... )

Need to know the equivalent way for C#
My C# code is

var provider = new ConfigFileAuthenticationDetailsProvider("D:\config", "DEFAULT");
try
{
var getSecretBundleRequest = new Oci.SecretsService.Requests.GetSecretBundleByNameRequest
{
VaultId = V_ID,
SecretName = S_NAME
};

    using (var client = new SecretsClient(provider, new ClientConfiguration()))
    {                    
            var response = await client.GetSecretBundleByName(getSecretBundleRequest);
            Base64SecretBundleContentDetails secretIdValue = (Base64SecretBundleContentDetails)response.SecretBundle.SecretBundleContent;
             string encodedString = secretIdValue.Content;
     }

}

OCI.DotNetSDK.IdentityDataPlane doesn't install all the required dependencies.

I am using sample test case given here,
https://docs.oracle.com/en-us/iaas/tools/dot-net-examples/29.4.0/identitydataplane/GenerateScopedAccessToken.cs.html,
to get db token from IAM using OCI .NET SDK.
I installed the latest OCI.DotNetSDK.IdentityDataPlane (v. 29.4.0) package from public nuget repository, https://www.nuget.org/packages/OCI.DotNetSDK.Identitydataplane/.
But it doesn't install BouncyCastle.NetCore package (v. 1.8.10), which is a required dependency, in order to run the test successfully. Is this expected?

If this is expected and it doesn't need to be installed, then, please could you let me know how can I resolve the following error.

GenerateScopedAccessToken Failed with Org.BouncyCastle.OpenSsl.PemException: problem creating ENCRYPTED private key: Org.BouncyCastle.Crypto.InvalidCipherTextException: pad block corrupted
at Org.BouncyCastle.Crypto.Paddings.Pkcs7Padding.PadCount(Byte[] input) in //crypto/src/crypto/paddings/Pkcs7Padding.cs:line 69
at Org.BouncyCastle.Crypto.Paddings.PaddedBufferedBlockCipher.DoFinal(Byte[] output, Int32 outOff) in /
/crypto/src/crypto/paddings/PaddedBufferedBlockCipher.cs:line 271
at Org.BouncyCastle.Crypto.BufferedBlockCipher.DoFinal(Byte[] input, Int32 inOff, Int32 inLen) in //crypto/src/crypto/BufferedBlockCipher.cs:line 300
at Org.BouncyCastle.Crypto.BufferedCipherBase.DoFinal(Byte[] input) in /
/crypto/src/crypto/BufferedCipherBase.cs:line 72
at Org.BouncyCastle.Pkcs.PrivateKeyInfoFactory.CreatePrivateKeyInfo(Char[] passPhrase, Boolean wrongPkcs12Zero, EncryptedPrivateKeyInfo encInfo) in //crypto/src/pkcs/PrivateKeyInfoFactory.cs:line 270
at Org.BouncyCastle.OpenSsl.PemReader.ReadPrivateKey(PemObject pemObject) in /
/crypto/src/openssl/PEMReader.cs:line 342
at Org.BouncyCastle.OpenSsl.PemReader.ReadPrivateKey(PemObject pemObject) in //crypto/src/openssl/PEMReader.cs:line 367
at Org.BouncyCastle.OpenSsl.PemReader.ReadObject() in /
/crypto/src/openssl/PEMReader.cs:line 97
at Oci.Common.Auth.FilePrivateKeySupplier.ReadKey()
at Oci.Common.Auth.FilePrivateKeySupplier.GetKey()
at Oci.Common.Auth.SimpleAuthenticationDetailsProvider.GetPrivateKey()
at Oci.Common.Auth.ConfigFileAuthenticationDetailsProvider.GetPrivateKey()
at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy, ISigner signer)
at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy)
at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider)
at Oci.Common.ClientBase..ctor(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration)
at Oci.Common.RegionalClientBase..ctor(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration)
at Oci.IdentitydataplaneService.DataplaneClient..ctor(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration, String endpoint)
at iam_core.Program.GetDBToken() in C:\Users\vikrkuku\source\repos\iam_core\iam_core\Program.cs:line 161

Best approach to check a service is deployed & accessible

Hi, I'm auditing multiple tenancies.. so have a mix with CloudGuard, DataSafe, MySQL deployed or not. Is there a preferred first query to see if the service is enabled in the tenancy, rather than having code looping through all LIST methods?

There are cases where some components are deployed & configured, and some not.

And there are cases where the permissions haven't been correctly applied, so I'd expect a 401/403 response.

But an initial method to query (a) is the service deployed, and (b) do I have access (read or above) would be very handy. Also let wasted load on the API servers.

Any pointers on a best method to start with, to try & exit, or if such an API call can/will be implemented to check first?

Thanks,

Justin.

InstancePrincipleExample fails with ArgumentNullException exception

While trying the InstancePrincipal example, I received an AgumentNullException after the following WARN message in console:

2020-09-09 10:03:14.4724|WARN|Oci.Common.Auth.AbstractRequestingAuthenticationDetailsProvider|Received exception: System.ArgumentException: Unable to find region from regionId .

It seems like http://169.254.169.254/opc/v2/instance/region URLs returns regionId ("eu-frankfurt-1" in my case) while this code expects region code ("fra"):

GetNetworkFirewallPolicy - not everything in output

Hi, I've used the SDK to audit an OCI native Palo Alto firewall, to pull it's config. In checking with our firewall team and producing, it is missing a range of child data in the Policy object - Application list only has the protocol list not ports, URL lists are showing Allow only, not the Urls that have been input.

Testing the API itself via the CLI "oci network-firewall network-firewall-policy get --network-firewall-policy-id **** --profile ****" returns all of the child data, with min/max ports/types for Applications, all Security Rule config, url lists etc.

For UrlLists the JSON object output is showing "Allow": [{}, {}, {}, {}], which gives the right quantity of URLs, just not the values. Is there some additional command/option that's needed for it to pull all of the other data??? I also extract the full loadbalancer configs, which are way more complex/deeper layers, in a single call without issue.

Retry fails with ObjectDisposedException for System.Net.Http.StreamContent

Code example to reproduce the issue:

public static string CreateKeyTest()
{

RetryConfiguration retry = new Oci.Common.Retry.RetryConfiguration
{
    GetNextDelayInSeconds = DelayStrategy.GetExponentialDelayInSeconds,
    TotalElapsedTimeInSecs = 30,
    MaxAttempts = 10,
    RetryableStatusCodeFamilies = new List<int>(new int[] { 1, 2, 3, 4, 5 })
};

CreateKeyDetails createKeyDetails = new CreateKeyDetails
{
    CompartmentId = compartment_id,
    DisplayName = "test key",
    KeyShape = new KeyShape
    {
        Algorithm = KeyShape.AlgorithmEnum.Rsa,
        Length = 384
    },
    ProtectionMode = CreateKeyDetails.ProtectionModeEnum.Software
};

CreateKeyRequest createKeyRequest = new CreateKeyRequest
{
    CreateKeyDetails = createKeyDetails
};

using (KmsManagementClient kmsManagementClient = new KmsManagementClient(new ConfigFileAuthenticationDetailsProvider("DEFAULT"), new ClientConfiguration(), your_key_vault_management_endpoint))
{
    Task<CreateKeyResponse> createKeyResponse = kmsManagementClient.CreateKey(createKeyRequest, retry);
    createKeyResponse.Wait();
    return createKeyResponse.Result.Key.Id;
}

}

To simulate the error and to trigger the retry provide an incorrect "compartment_id".
The very first retry will fail with ObjectDisposedException in SigningUtils.cs:line 105

Stack trace:

at System.Net.Http.HttpContent.CheckDisposed()\r\n at System.Net.Http.HttpContent.CopyToAsync(Stream stream, TransportContext context)\r\n
at Oci.Common.Http.Signing.Internal.SigningUtils.d__3.MoveNext()
in Common\Src\Http\Signing\Internal\SigningUtils.cs:line 105"

BouncyCastle Error

Hi!

when i finish config in windows and run in the first time . it throw an error e.g:
System.InvalidCastException: Unable to cast object of type 'Org.BouncyCastle.Crypto.Parameters.RsaKeyParameters' to type 'Org.BouncyCastle.Crypto.Parameters.RsaPrivateCrtKeyParameters'. at Oci.Common.Auth.FilePrivateKeySupplier.ReadKey() at Oci.Common.Auth.FilePrivateKeySupplier.GetKey() at Oci.Common.Auth.SimpleAuthenticationDetailsProvider.GetPrivateKey() at Oci.Common.Auth.ConfigFileAuthenticationDetailsProvider.GetPrivateKey() at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy, ISigner signer) at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider, SigningStrategy signingStrategy) at Oci.Common.Http.Signing.DefaultRequestSigner..ctor(IBasicAuthenticationDetailsProvider authDetailsProvider) at Oci.Common.ClientBase..ctor(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration) at Oci.Common.RegionalClientBase..ctor(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration) at Oci.IdentityService.IdentityClient..ctor(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration, String endpoint)

Instance Principal Auth?

Thanks for amazing news with the SDK for the .NET!
Can you please tell, is there any possibility to use Instance Principal authorization? If not, when do you plan to support it?
Our project is highly depends on the .NET stack, and we will need to use Instance Principal auth from the each our VM.

Thanks in advance!

System.PlatformNotSupportedException: Operation is not supported on this platform

Hi,

Please comment out/remove line#21 (

SslProtocols = SslProtocols.Tls12;
) in Oci.Common.Http.RestClientHandler. It's not needed for .Net 4.6 and above and causes System.PlatformNotSupportedException when SDK is used with .Net Framework (pre 4.7.2) target applications.

You may access relevant API doc here - https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.sslprotocols?view=netframework-4.7.1#System_Net_Http_HttpClientHandler_SslProtocols

Thanks,
Anuj

Call to HeadObject on large file causes exception "Cannot write more bytes to the buffer than the configured maximum buffer size: 2147483647."

Apologies if I am using this API function incorrectly, but to me it seems a call to HeadObject() to determine the size of a file on OCI object storage is allocating memory for the entire file. If this is a large file it causes the exception "Cannot write more bytes to the buffer than the configured maximum buffer size: 2147483647." Small files work fine but I cannot set the buffer big enough in ClientConfiguration.ResponseContentBufferBytes for larger files (also I don't want to as I don't see why I need to allocate this buffer just to do a HEAD call).

        using (var osClient = new ObjectStorageClient(device.ToAuthProvider(),
            TransferOciSystem.ClientConfigFactory.GetClientConfig()))
        {
            var headRequest = new HeadObjectRequest
            {
                BucketName = device.Bucket,
                ObjectName = fnet.FILENAME,
                NamespaceName = device.Credentials.Namespace
            };

            var headResponse = await osClient.HeadObject(headRequest);

            if (headResponse.ContentLength == null)
            {
                return new ActionResult
                {
                    IsTaskComplete = true,
                    Error = "Failed to get file length"
                };
            }

            var fileLength = headResponse.ContentLength.Value;
    }

List & Get CrossConnects and CrossConnectGroups failing

Hi,
I am unable to list or get CrossConnects or CrossConnectGroups via either the API or the CLI. I can access all of the data in the console without problem.

I've tested this in the latest API and in the latest CLI, with my godmode account, and had the core administrator /builder on a tenancy test it ... still the same with a 404....

I have tried adding additional policies in case it needed something else - in case it being the gateway to the outside world, that it had more restrictive access for API & CLI.... not to be.

  • allow group XXXX to inspect cross-connects in tenancy
  • allow group XXXX to inspect cross-connect-groups in tenancy
  • allow group XXXX to inspect virtual-network-family in tenancy

Is this API working anywhere, I've checked across 10 tenancies in UK/US, and nothing is output.

I can see the data I want in the console, but want to extract it en-masse from all customer tenancies to check on a range of configurations automatically.

Best Regards,

Justin.

Unable to get the secret value with secret OCID

I used the example as mentioned in https://docs.oracle.com/en-us/iaas/tools/dot-net-examples/32.1.0/secrets/GetSecretBundle.cs.html

With this example, I can retrieve the secret content. As per the code it is mentioned as below
[JsonProperty(PropertyName = "secretBundleContent")] public SecretBundleContentDetails SecretBundleContent { get; set; }

But the value is present in "Base64SecretBundleContentDetails".

Debugging result to see the error
Screenshot 2022-03-01 at 3 14 11 PM

Sample code

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
 
using Oci.Common;
using Oci.Common.Auth;
using Oci.Common.Retry;
using Oci.IdentityService;
using Oci.IdentityService.Models;
using Oci.IdentityService.Requests;
using Oci.IdentityService.Responses;
using Oci.KeymanagementService;
using Oci.VaultService;
using System.Text.Json;
using Oci.SecretsService;

namespace dotnet
{
    class Program
    {
        private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

        private static int DefaultKeyLength = 32;

        static async Task Main(string[] args)
        {
            logger.Info("Initializing example");

            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");

            try
            {
                Console.WriteLine("Initializing ....");
                await GetSecret();
            }
            catch (Exception e)
            {
                logger.Error($"Failed to perform operations on Vault: {e}");
            }
            finally
            {
                
            }

            logger.Info("End example");
        }


        public static async Task GetSecret()
        {
            // Create a request and dependent object(s).
			var getSecretRequest = new Oci.VaultService.Requests.GetSecretRequest
			{
				SecretId = "ocid1.vaultsecret.oc1.ap-mumbai-1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
			};

            // Create a default authentication provider that uses the DEFAULT
            // profile in the configuration file.
            // Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new VaultsClient(provider, new ClientConfiguration()))
				{
					var response = await client.GetSecret(getSecretRequest);
                    Console.WriteLine(JsonSerializer.Serialize(response));

				}

                var getSecretBundleRequest = new Oci.SecretsService.Requests.GetSecretBundleRequest
                {
                    SecretId = "ocid1.vaultsecret.oc1.ap-mumbai-1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                    /// SecretVersionName = "db-password",
                    // VersionNumber = 1,
                    // Stage = Oci.SecretsService.Requests.GetSecretBundleRequest.StageEnum.Latest,
                };

                using (var client = new SecretsClient(provider, new ClientConfiguration()))
				{
					var response = await client.GetSecretBundle(getSecretBundleRequest);
					// Retrieve value from the response.
					var secretIdValue = response.SecretBundle.SecretBundleContent;
                    Console.WriteLine(JsonSerializer.Serialize(response.SecretBundle.SecretBundleContent));
				}

            }
            catch (Exception e)
            {
                Console.WriteLine($"GetSecret Failed with {e.Message}");
                throw e;
            }
        }

        private static async Task ListOciRegionSubscriptions(IdentityClient client, string compartmentId)
        {
            // List RegionSubscriptions
            ListRegionSubscriptionsRequest listRegionSubscriptionsRequest = new ListRegionSubscriptionsRequest
            {
                TenancyId = compartmentId
            };
            RetryConfiguration retryConfiguration = new RetryConfiguration
            {
                // Enable exponential backoff with Full Jitter.
                GetNextDelayInSeconds = GetJitterDelayInSeconds
            };
            ListRegionSubscriptionsResponse listRegionSubscriptionsResponse = await client.ListRegionSubscriptions(listRegionSubscriptionsRequest, retryConfiguration);
            List<RegionSubscription> regionSubscriptions = listRegionSubscriptionsResponse.Items;
            //logger.Info("List RegionSubscriptions");
            //logger.Info("=========================");
            foreach (RegionSubscription regionSubscription in regionSubscriptions)
            {
                Console.WriteLine($"{regionSubscription.RegionName} : {regionSubscription.RegionKey}");
                //logger.Info($"{regionSubscription.RegionName} : {regionSubscription.RegionKey}");
            }
        }
 
        /// <summary>
        /// Defining a custom retry strategy that mimics an exponential backoff with full jitter to reduce
        /// contention between competing calls
        /// </summary>
        private static double GetJitterDelayInSeconds(int retryAttempt)
        {
            Random random = new Random();
            return random.NextDouble() * Math.Pow(2, retryAttempt);
        }
    }
}

```

DataSafe-models-LifecycleState invalid enum value

Hi,
The DataSafe model for LifecycleState has an enum value "NA", the output value from the API is "NEEDS_ATTENTION", which is causing and error in conversion to type LifecycleState, the requested value was not found.

This is referenced when trying to download target databases.

Help: PrivateKeySupplier: Constructor argument

What is expected constructor argument for PrivateKeySupplier class?
I have private and public keys separately, I combined the to generate AsymmetricCipherKeyPair,

var privateKey = "....";
var publicKey = "...."
var privateKeyCipher = (AsymmetricKeyParameter)new PemReader(new StringReader(privateKey)).ReadObject();
var publicKeyCipher = (AsymmetricKeyParameter)new PemReader(new StringReader(publicKey)).ReadObject();
var akp = new AsymmetricCipherKeyPair(publickey, privateKey);
var privateKeySupplier = new PrivateKeySupplier(akp.ToString()); //this is the line I'm help for

But, not exactly sure how do I convert string which can be passed as an argument?
Please help.

AppDependencyManagement - 2 invalid API definitions in SDK

Hi,

AdmService, there are 2 list APIs, that are failing when called without parameters. No parameters are specified as required in the documentation. Testing the same calls in the CLI found on both occasions they work with the CompartmentId parameter.

ListKnowledgeBasesRequest
ListVulnerabilityAuditsRequest

The CLI documentation states "Returns a list of KnowledgeBases based on the specified query parameters. At least id or compartmentId query parameter must be provided". Can this be added to the C# SDK documentation?

Best Regards,
Justin.

Getting db token and private key from IAM using OCI .NET SDK

I'm trying to get a db token and a private key from IAM using OCI .NET SDK. I installed the latest nuget package, 29.3.0, but I don't seem to find the required APIs/Classes which can be used for this purpose. Can you please help me in writing a sample .NET test case, which will use oci .net sdk to get the db token from the IAM? Is this functionality out yet? Is there any documentation available for this use case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.