1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. getDbCredentials
Oracle Cloud Infrastructure v2.3.0 published on Wednesday, Jul 17, 2024 by Pulumi

oci.Identity.getDbCredentials

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v2.3.0 published on Wednesday, Jul 17, 2024 by Pulumi

    This data source provides the list of Db Credentials in Oracle Cloud Infrastructure Identity service.

    Lists the DB credentials for the specified user. The returned object contains the credential’s OCID

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testDbCredentials = oci.Identity.getDbCredentials({
        userId: testUser.id,
        name: dbCredentialName,
        state: dbCredentialState,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_db_credentials = oci.Identity.get_db_credentials(user_id=test_user["id"],
        name=db_credential_name,
        state=db_credential_state)
    
    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.GetDbCredentials(ctx, &identity.GetDbCredentialsArgs{
    			UserId: testUser.Id,
    			Name:   pulumi.StringRef(dbCredentialName),
    			State:  pulumi.StringRef(dbCredentialState),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testDbCredentials = Oci.Identity.GetDbCredentials.Invoke(new()
        {
            UserId = testUser.Id,
            Name = dbCredentialName,
            State = dbCredentialState,
        });
    
    });
    
    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.GetDbCredentialsArgs;
    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 testDbCredentials = IdentityFunctions.getDbCredentials(GetDbCredentialsArgs.builder()
                .userId(testUser.id())
                .name(dbCredentialName)
                .state(dbCredentialState)
                .build());
    
        }
    }
    
    variables:
      testDbCredentials:
        fn::invoke:
          Function: oci:Identity:getDbCredentials
          Arguments:
            userId: ${testUser.id}
            name: ${dbCredentialName}
            state: ${dbCredentialState}
    

    Using getDbCredentials

    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 getDbCredentials(args: GetDbCredentialsArgs, opts?: InvokeOptions): Promise<GetDbCredentialsResult>
    function getDbCredentialsOutput(args: GetDbCredentialsOutputArgs, opts?: InvokeOptions): Output<GetDbCredentialsResult>
    def get_db_credentials(filters: Optional[Sequence[_identity.GetDbCredentialsFilter]] = None,
                           name: Optional[str] = None,
                           state: Optional[str] = None,
                           user_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetDbCredentialsResult
    def get_db_credentials_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetDbCredentialsFilterArgs]]]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           state: Optional[pulumi.Input[str]] = None,
                           user_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetDbCredentialsResult]
    func GetDbCredentials(ctx *Context, args *GetDbCredentialsArgs, opts ...InvokeOption) (*GetDbCredentialsResult, error)
    func GetDbCredentialsOutput(ctx *Context, args *GetDbCredentialsOutputArgs, opts ...InvokeOption) GetDbCredentialsResultOutput

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

    public static class GetDbCredentials 
    {
        public static Task<GetDbCredentialsResult> InvokeAsync(GetDbCredentialsArgs args, InvokeOptions? opts = null)
        public static Output<GetDbCredentialsResult> Invoke(GetDbCredentialsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDbCredentialsResult> getDbCredentials(GetDbCredentialsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:Identity/getDbCredentials:getDbCredentials
      arguments:
        # arguments dictionary

    The following arguments are supported:

    UserId string
    The OCID of the user.
    Filters List<GetDbCredentialsFilter>
    Name string
    A filter to only return resources that match the given name exactly.
    State string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    UserId string
    The OCID of the user.
    Filters []GetDbCredentialsFilter
    Name string
    A filter to only return resources that match the given name exactly.
    State string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    userId String
    The OCID of the user.
    filters List<GetDbCredentialsFilter>
    name String
    A filter to only return resources that match the given name exactly.
    state String
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    userId string
    The OCID of the user.
    filters GetDbCredentialsFilter[]
    name string
    A filter to only return resources that match the given name exactly.
    state string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    user_id str
    The OCID of the user.
    filters Sequence[identity.GetDbCredentialsFilter]
    name str
    A filter to only return resources that match the given name exactly.
    state str
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    userId String
    The OCID of the user.
    filters List<Property Map>
    name String
    A filter to only return resources that match the given name exactly.
    state String
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

    getDbCredentials Result

    The following output properties are available:

    DbCredentials List<GetDbCredentialsDbCredential>
    The list of db_credentials.
    Id string
    The provider-assigned unique ID for this managed resource.
    UserId string
    The OCID of the user the DB credential belongs to.
    Filters List<GetDbCredentialsFilter>
    Name string
    State string
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
    DbCredentials []GetDbCredentialsDbCredential
    The list of db_credentials.
    Id string
    The provider-assigned unique ID for this managed resource.
    UserId string
    The OCID of the user the DB credential belongs to.
    Filters []GetDbCredentialsFilter
    Name string
    State string
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
    dbCredentials List<GetDbCredentialsDbCredential>
    The list of db_credentials.
    id String
    The provider-assigned unique ID for this managed resource.
    userId String
    The OCID of the user the DB credential belongs to.
    filters List<GetDbCredentialsFilter>
    name String
    state String
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
    dbCredentials GetDbCredentialsDbCredential[]
    The list of db_credentials.
    id string
    The provider-assigned unique ID for this managed resource.
    userId string
    The OCID of the user the DB credential belongs to.
    filters GetDbCredentialsFilter[]
    name string
    state string
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
    db_credentials Sequence[identity.GetDbCredentialsDbCredential]
    The list of db_credentials.
    id str
    The provider-assigned unique ID for this managed resource.
    user_id str
    The OCID of the user the DB credential belongs to.
    filters Sequence[identity.GetDbCredentialsFilter]
    name str
    state str
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
    dbCredentials List<Property Map>
    The list of db_credentials.
    id String
    The provider-assigned unique ID for this managed resource.
    userId String
    The OCID of the user the DB credential belongs to.
    filters List<Property Map>
    name String
    state String
    The credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it.

    Supporting Types

    GetDbCredentialsDbCredential

    Description string
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    Id string
    The OCID of the DB credential.
    LifecycleDetails string
    Password string
    State string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    TimeCreated string
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    UserId string
    The OCID of the user.
    Description string
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    Id string
    The OCID of the DB credential.
    LifecycleDetails string
    Password string
    State string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    TimeCreated string
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    TimeExpires string
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    UserId string
    The OCID of the user.
    description String
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    id String
    The OCID of the DB credential.
    lifecycleDetails String
    password String
    state String
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    timeCreated String
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    userId String
    The OCID of the user.
    description string
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    id string
    The OCID of the DB credential.
    lifecycleDetails string
    password string
    state string
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    timeCreated string
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires string
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    userId string
    The OCID of the user.
    description str
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    id str
    The OCID of the DB credential.
    lifecycle_details str
    password str
    state str
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    time_created str
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    time_expires str
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    user_id str
    The OCID of the user.
    description String
    The description you assign to the DB credential. Does not have to be unique, and it's changeable.
    id String
    The OCID of the DB credential.
    lifecycleDetails String
    password String
    state String
    A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
    timeCreated String
    Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    timeExpires String
    Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
    userId String
    The OCID of the user.

    GetDbCredentialsFilter

    Name string
    A filter to only return resources that match the given name exactly.
    Values List<string>
    Regex bool
    Name string
    A filter to only return resources that match the given name exactly.
    Values []string
    Regex bool
    name String
    A filter to only return resources that match the given name exactly.
    values List<String>
    regex Boolean
    name string
    A filter to only return resources that match the given name exactly.
    values string[]
    regex boolean
    name str
    A filter to only return resources that match the given name exactly.
    values Sequence[str]
    regex bool
    name String
    A filter to only return resources that match the given name exactly.
    values 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.
    oci logo
    Oracle Cloud Infrastructure v2.3.0 published on Wednesday, Jul 17, 2024 by Pulumi