1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. getApiKeys
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

oci.Identity.getApiKeys

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

This data source provides the list of Api Keys in Oracle Cloud Infrastructure Identity service.

Lists the API signing keys for the specified user. A user can have a maximum of three keys.

Every user has permission to use this API call for their own user ID. An administrator in your organization does not need to write a policy to give users this ability.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testApiKeys = oci.Identity.getApiKeys({
    userId: testUser.id,
});
Copy
import pulumi
import pulumi_oci as oci

test_api_keys = oci.Identity.get_api_keys(user_id=test_user["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/identity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := identity.GetApiKeys(ctx, &identity.GetApiKeysArgs{
			UserId: testUser.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testApiKeys = Oci.Identity.GetApiKeys.Invoke(new()
    {
        UserId = testUser.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.IdentityFunctions;
import com.pulumi.oci.Identity.inputs.GetApiKeysArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testApiKeys = IdentityFunctions.getApiKeys(GetApiKeysArgs.builder()
            .userId(testUser.id())
            .build());

    }
}
Copy
variables:
  testApiKeys:
    fn::invoke:
      function: oci:Identity:getApiKeys
      arguments:
        userId: ${testUser.id}
Copy

Using getApiKeys

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getApiKeys(args: GetApiKeysArgs, opts?: InvokeOptions): Promise<GetApiKeysResult>
function getApiKeysOutput(args: GetApiKeysOutputArgs, opts?: InvokeOptions): Output<GetApiKeysResult>
Copy
def get_api_keys(filters: Optional[Sequence[_identity.GetApiKeysFilter]] = None,
                 user_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetApiKeysResult
def get_api_keys_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetApiKeysFilterArgs]]]] = None,
                 user_id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetApiKeysResult]
Copy
func GetApiKeys(ctx *Context, args *GetApiKeysArgs, opts ...InvokeOption) (*GetApiKeysResult, error)
func GetApiKeysOutput(ctx *Context, args *GetApiKeysOutputArgs, opts ...InvokeOption) GetApiKeysResultOutput
Copy

> Note: This function is named GetApiKeys in the Go SDK.

public static class GetApiKeys 
{
    public static Task<GetApiKeysResult> InvokeAsync(GetApiKeysArgs args, InvokeOptions? opts = null)
    public static Output<GetApiKeysResult> Invoke(GetApiKeysInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetApiKeysResult> getApiKeys(GetApiKeysArgs args, InvokeOptions options)
public static Output<GetApiKeysResult> getApiKeys(GetApiKeysArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Identity/getApiKeys:getApiKeys
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

UserId This property is required. string
The OCID of the user.
Filters Changes to this property will trigger replacement. List<GetApiKeysFilter>
UserId This property is required. string
The OCID of the user.
Filters Changes to this property will trigger replacement. []GetApiKeysFilter
userId This property is required. String
The OCID of the user.
filters Changes to this property will trigger replacement. List<GetApiKeysFilter>
userId This property is required. string
The OCID of the user.
filters Changes to this property will trigger replacement. GetApiKeysFilter[]
user_id This property is required. str
The OCID of the user.
filters Changes to this property will trigger replacement. Sequence[identity.GetApiKeysFilter]
userId This property is required. String
The OCID of the user.
filters Changes to this property will trigger replacement. List<Property Map>

getApiKeys Result

The following output properties are available:

ApiKeys List<GetApiKeysApiKey>
The list of api_keys.
Id string
The provider-assigned unique ID for this managed resource.
UserId string
The OCID of the user the key belongs to.
Filters List<GetApiKeysFilter>
ApiKeys []GetApiKeysApiKey
The list of api_keys.
Id string
The provider-assigned unique ID for this managed resource.
UserId string
The OCID of the user the key belongs to.
Filters []GetApiKeysFilter
apiKeys List<GetApiKeysApiKey>
The list of api_keys.
id String
The provider-assigned unique ID for this managed resource.
userId String
The OCID of the user the key belongs to.
filters List<GetApiKeysFilter>
apiKeys GetApiKeysApiKey[]
The list of api_keys.
id string
The provider-assigned unique ID for this managed resource.
userId string
The OCID of the user the key belongs to.
filters GetApiKeysFilter[]
api_keys Sequence[identity.GetApiKeysApiKey]
The list of api_keys.
id str
The provider-assigned unique ID for this managed resource.
user_id str
The OCID of the user the key belongs to.
filters Sequence[identity.GetApiKeysFilter]
apiKeys List<Property Map>
The list of api_keys.
id String
The provider-assigned unique ID for this managed resource.
userId String
The OCID of the user the key belongs to.
filters List<Property Map>

Supporting Types

GetApiKeysApiKey

Fingerprint This property is required. string
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
Id This property is required. string
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
InactiveStatus This property is required. string
The detailed status of INACTIVE lifecycleState.
KeyValue This property is required. string
The key's value.
State This property is required. string
The API key's current state.
TimeCreated This property is required. string
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
UserId This property is required. string
The OCID of the user.
Fingerprint This property is required. string
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
Id This property is required. string
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
InactiveStatus This property is required. string
The detailed status of INACTIVE lifecycleState.
KeyValue This property is required. string
The key's value.
State This property is required. string
The API key's current state.
TimeCreated This property is required. string
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
UserId This property is required. string
The OCID of the user.
fingerprint This property is required. String
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
id This property is required. String
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
inactiveStatus This property is required. String
The detailed status of INACTIVE lifecycleState.
keyValue This property is required. String
The key's value.
state This property is required. String
The API key's current state.
timeCreated This property is required. String
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
userId This property is required. String
The OCID of the user.
fingerprint This property is required. string
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
id This property is required. string
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
inactiveStatus This property is required. string
The detailed status of INACTIVE lifecycleState.
keyValue This property is required. string
The key's value.
state This property is required. string
The API key's current state.
timeCreated This property is required. string
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
userId This property is required. string
The OCID of the user.
fingerprint This property is required. str
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
id This property is required. str
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
inactive_status This property is required. str
The detailed status of INACTIVE lifecycleState.
key_value This property is required. str
The key's value.
state This property is required. str
The API key's current state.
time_created This property is required. str
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
user_id This property is required. str
The OCID of the user.
fingerprint This property is required. String
The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef).
id This property is required. String
An Oracle-assigned identifier for the key, in this format: TENANCY_OCID/USER_OCID/KEY_FINGERPRINT.
inactiveStatus This property is required. String
The detailed status of INACTIVE lifecycleState.
keyValue This property is required. String
The key's value.
state This property is required. String
The API key's current state.
timeCreated This property is required. String
Date and time the ApiKey object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
userId This property is required. String
The OCID of the user.

GetApiKeysFilter

Name This property is required. string
Values This property is required. List<string>
Regex bool
Name This property is required. string
Values This property is required. []string
Regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean
name This property is required. string
values This property is required. string[]
regex boolean
name This property is required. str
values This property is required. Sequence[str]
regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi