Comments (6)
Hi @jbcintra
Thank you for reaching out.
An example for using ListKeys can be found at: https://docs.oracle.com/en-us/iaas/api/#/en/key/release/KeySummary/ListKeys
If you still see the issue can you provide the following:-
- The .NET SDK version you are using?
- A code snippet.
from oci-dotnet-sdk.
I'm using the latest SDK, updated this week. The issue is running code to query keys ... fails and asks for another parameter that is not defined in the Model, nor in the examples, so no means to pass it in.
Simple code passing only CompartmentId:
public IEnumerable ListKeys(string compartmentId, KmsManagementClient client)
{
var request = new ListKeysRequest() {CompartmentId = compartmentId };
var response = client.ListKeys(request);
return response.Result.Items;
}
Then using the CLI against the API, it raises an error unless the parameter --endpoint is included e.g.
oci kms management key list --compartment-id
with or without "--all" triggers the missing variable "--endpoint"
From the Vaults output, passing in the ManagementEndpoint as the parameter --endpoint runs properly. (CryptoEndpoint passed in returns 404)
from oci-dotnet-sdk.
Hi @jbcintra
You can set the endpoint following the example at: https://github.com/oracle/oci-dotnet-sdk/blob/master/Examples/KeymanagementExample.cs
Essentially what you have to do is to use the Endpoint provided by the VaultClient as mentioned below:-
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
var vaultId = Environment.GetEnvironmentVariable("VAULT_ID");
KmsVaultClient kmsVaultClient = new KmsVaultClient(provider);
KmsManagementClient kmsManagementClient = new KmsManagementClient(provider);
Vault vault = await GetVault(kmsVaultClient, vaultId);
// The ManagementClient use Vault specific endpoints; Set them now.
kmsManagementClient.SetEndpoint(vault.ManagementEndpoint);
Where GetVault is the following:-
private static async Task<Vault> GetVault(KmsVaultClient kmsVaultClient, string vaultId)
{
logger.Info("Get Vault");
GetVaultRequest getVaultRequest = new GetVaultRequest
{
VaultId = vaultId
};
GetVaultResponse getVaultResponse = await kmsVaultClient.GetVault(getVaultRequest);
logger.Info($"Retrieved vault: {getVaultResponse.Vault.DisplayName}");
return getVaultResponse.Vault;
}
from oci-dotnet-sdk.
Hi @github-anurag
Thanks for the pointer. I've had to rejig the code to create the KmsManagementClient just in time with provider, clientConfig, and endpoint.
It makes the code more cumbersome having to create new clients constantly, unlike those I've created for the rest of the OCI stack (~50), this is the only one with that requirement. It's an issue as I'm auditing multiple tenancies and multiple vaults, so have to enumerate the tenancies and vaults, then create completely new KmsManagementClients on every pass. But ... it's working.
Is this element going to be moved into being a parameter to align with all the other OciClients?
Thanks,
Justin.
from oci-dotnet-sdk.
Hi @jbcintra,
The KMS client is a special client and does not align with the other OCI Clients.
from oci-dotnet-sdk.
Thanks @github-anurag ! Glad it's just the one.
from oci-dotnet-sdk.
Related Issues (20)
- Unable to get the secret value with secret OCID HOT 1
- DataSafe-models-LifecycleState invalid enum value HOT 13
- support for Oracle Container Cloud Service HOT 5
- Getting Bucket Size HOT 8
- GetNetworkFirewallPolicy - not everything in output HOT 13
- LogAnalytics - ListLabelPriorities - conversion failure HOT 3
- LogAnalytics - ListScheduledTasks - Enum parameter issue HOT 5
- AppDependencyManagement - 2 invalid API definitions in SDK HOT 5
- Datasafe - ListAlertPolicies HOT 13
- OrganizationsClient -> ListOrganizations (rootId), stuck when listing All HOT 7
- No version bump for DLLs
- How to get the Url of a storage object? HOT 1
- IdentityDomains List functions refer to var baseUri which does not exist HOT 2
- Missing OkeWorkloadIdentityAuthenticationDetailsProvider HOT 3
- OVCP ListEsxiHostsRequest fails with invalid params
- List & Get CrossConnects and CrossConnectGroups failing
- Identity Domains, where are Applications? HOT 1
- Calling GetSecretBundleByName from behind a proxy HOT 3
- PrivateKeySupplier missing support for AsymmetricKeyParameter HOT 1
- Retry fails with ObjectDisposedException for System.Net.Http.StreamContent HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oci-dotnet-sdk.