1. Packages
  2. Civo
  3. API Docs
  4. getObjectStoreCredential
Civo v2.3.18 published on Tuesday, Jun 11, 2024 by Pulumi

civo.getObjectStoreCredential

Explore with Pulumi AI

civo logo
Civo v2.3.18 published on Tuesday, Jun 11, 2024 by Pulumi

    Get information of an Object Store Credential for use in other resources. This data source provides all of the Object Store Credential’s properties as configured on your Civo account.

    Note: This data source returns a single Object Store Credential. When specifying a name, an error will be raised if more than one Object Store Credentials with the same name found.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as civo from "@pulumi/civo";
    
    // Read a credential for the object store
    const backup = civo.getObjectStoreCredential({
        name: "backup-server",
    });
    // Use the credential to create a bucket
    const backupObjectStore = new civo.ObjectStore("backup", {
        name: "backup-server",
        maxSizeGb: 500,
        region: "LON1",
        accessKeyId: backup.then(backup => backup.accessKeyId),
    });
    
    import pulumi
    import pulumi_civo as civo
    
    # Read a credential for the object store
    backup = civo.get_object_store_credential(name="backup-server")
    # Use the credential to create a bucket
    backup_object_store = civo.ObjectStore("backup",
        name="backup-server",
        max_size_gb=500,
        region="LON1",
        access_key_id=backup.access_key_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Read a credential for the object store
    		backup, err := civo.LookupObjectStoreCredential(ctx, &civo.LookupObjectStoreCredentialArgs{
    			Name: pulumi.StringRef("backup-server"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Use the credential to create a bucket
    		_, err = civo.NewObjectStore(ctx, "backup", &civo.ObjectStoreArgs{
    			Name:        pulumi.String("backup-server"),
    			MaxSizeGb:   pulumi.Int(500),
    			Region:      pulumi.String("LON1"),
    			AccessKeyId: pulumi.String(backup.AccessKeyId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Civo = Pulumi.Civo;
    
    return await Deployment.RunAsync(() => 
    {
        // Read a credential for the object store
        var backup = Civo.GetObjectStoreCredential.Invoke(new()
        {
            Name = "backup-server",
        });
    
        // Use the credential to create a bucket
        var backupObjectStore = new Civo.ObjectStore("backup", new()
        {
            Name = "backup-server",
            MaxSizeGb = 500,
            Region = "LON1",
            AccessKeyId = backup.Apply(getObjectStoreCredentialResult => getObjectStoreCredentialResult.AccessKeyId),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.civo.CivoFunctions;
    import com.pulumi.civo.inputs.GetObjectStoreCredentialArgs;
    import com.pulumi.civo.ObjectStore;
    import com.pulumi.civo.ObjectStoreArgs;
    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) {
            // Read a credential for the object store
            final var backup = CivoFunctions.getObjectStoreCredential(GetObjectStoreCredentialArgs.builder()
                .name("backup-server")
                .build());
    
            // Use the credential to create a bucket
            var backupObjectStore = new ObjectStore("backupObjectStore", ObjectStoreArgs.builder()
                .name("backup-server")
                .maxSizeGb(500)
                .region("LON1")
                .accessKeyId(backup.applyValue(getObjectStoreCredentialResult -> getObjectStoreCredentialResult.accessKeyId()))
                .build());
    
        }
    }
    
    resources:
      # Use the credential to create a bucket
      backupObjectStore:
        type: civo:ObjectStore
        name: backup
        properties:
          name: backup-server
          maxSizeGb: 500
          region: LON1
          accessKeyId: ${backup.accessKeyId}
    variables:
      # Read a credential for the object store
      backup:
        fn::invoke:
          Function: civo:getObjectStoreCredential
          Arguments:
            name: backup-server
    

    Using getObjectStoreCredential

    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 getObjectStoreCredential(args: GetObjectStoreCredentialArgs, opts?: InvokeOptions): Promise<GetObjectStoreCredentialResult>
    function getObjectStoreCredentialOutput(args: GetObjectStoreCredentialOutputArgs, opts?: InvokeOptions): Output<GetObjectStoreCredentialResult>
    def get_object_store_credential(id: Optional[str] = None,
                                    name: Optional[str] = None,
                                    region: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetObjectStoreCredentialResult
    def get_object_store_credential_output(id: Optional[pulumi.Input[str]] = None,
                                    name: Optional[pulumi.Input[str]] = None,
                                    region: Optional[pulumi.Input[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetObjectStoreCredentialResult]
    func LookupObjectStoreCredential(ctx *Context, args *LookupObjectStoreCredentialArgs, opts ...InvokeOption) (*LookupObjectStoreCredentialResult, error)
    func LookupObjectStoreCredentialOutput(ctx *Context, args *LookupObjectStoreCredentialOutputArgs, opts ...InvokeOption) LookupObjectStoreCredentialResultOutput

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

    public static class GetObjectStoreCredential 
    {
        public static Task<GetObjectStoreCredentialResult> InvokeAsync(GetObjectStoreCredentialArgs args, InvokeOptions? opts = null)
        public static Output<GetObjectStoreCredentialResult> Invoke(GetObjectStoreCredentialInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetObjectStoreCredentialResult> getObjectStoreCredential(GetObjectStoreCredentialArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: civo:index/getObjectStoreCredential:getObjectStoreCredential
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of the Object Store Credential
    Name string
    The name of the Object Store Credential
    Region string
    The region of an existing Object Store
    Id string
    The ID of the Object Store Credential
    Name string
    The name of the Object Store Credential
    Region string
    The region of an existing Object Store
    id String
    The ID of the Object Store Credential
    name String
    The name of the Object Store Credential
    region String
    The region of an existing Object Store
    id string
    The ID of the Object Store Credential
    name string
    The name of the Object Store Credential
    region string
    The region of an existing Object Store
    id str
    The ID of the Object Store Credential
    name str
    The name of the Object Store Credential
    region str
    The region of an existing Object Store
    id String
    The ID of the Object Store Credential
    name String
    The name of the Object Store Credential
    region String
    The region of an existing Object Store

    getObjectStoreCredential Result

    The following output properties are available:

    AccessKeyId string
    The access key id of the Object Store Credential
    SecretAccessKey string
    The secret access key of the Object Store Credential
    Status string
    The status of the Object Store Credential
    Id string
    The ID of the Object Store Credential
    Name string
    The name of the Object Store Credential
    Region string
    The region of an existing Object Store
    AccessKeyId string
    The access key id of the Object Store Credential
    SecretAccessKey string
    The secret access key of the Object Store Credential
    Status string
    The status of the Object Store Credential
    Id string
    The ID of the Object Store Credential
    Name string
    The name of the Object Store Credential
    Region string
    The region of an existing Object Store
    accessKeyId String
    The access key id of the Object Store Credential
    secretAccessKey String
    The secret access key of the Object Store Credential
    status String
    The status of the Object Store Credential
    id String
    The ID of the Object Store Credential
    name String
    The name of the Object Store Credential
    region String
    The region of an existing Object Store
    accessKeyId string
    The access key id of the Object Store Credential
    secretAccessKey string
    The secret access key of the Object Store Credential
    status string
    The status of the Object Store Credential
    id string
    The ID of the Object Store Credential
    name string
    The name of the Object Store Credential
    region string
    The region of an existing Object Store
    access_key_id str
    The access key id of the Object Store Credential
    secret_access_key str
    The secret access key of the Object Store Credential
    status str
    The status of the Object Store Credential
    id str
    The ID of the Object Store Credential
    name str
    The name of the Object Store Credential
    region str
    The region of an existing Object Store
    accessKeyId String
    The access key id of the Object Store Credential
    secretAccessKey String
    The secret access key of the Object Store Credential
    status String
    The status of the Object Store Credential
    id String
    The ID of the Object Store Credential
    name String
    The name of the Object Store Credential
    region String
    The region of an existing Object Store

    Package Details

    Repository
    Civo pulumi/pulumi-civo
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Civo v2.3.18 published on Tuesday, Jun 11, 2024 by Pulumi