1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. sql
  5. getCaCerts
Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi

gcp.sql.getCaCerts

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi

    Get all of the trusted Certificate Authorities (CAs) for the specified SQL database instance. For more information see the official documentation and API.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    	
    object NotImplemented(string errorMessage) 
    {
        throw new System.NotImplementedException(errorMessage);
    }
    
    return await Deployment.RunAsync(() => 
    {
        var caCerts = Gcp.Sql.GetCaCerts.Invoke(new()
        {
            Instance = "primary-database-server",
        });
    
        var furthestExpirationTime = NotImplemented("reverse(sort([fork,vindata.google_sql_ca_certs.ca_certs.certs:v.expiration_time]))")[0];
    
        var latestCaCert = .Where(v => v.ExpirationTime == furthestExpirationTime).Select(v => 
        {
            return v.Cert;
        }).ToList();
    
        return new Dictionary<string, object?>
        {
            ["dbLatestCaCert"] = latestCaCert,
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func notImplemented(message string) pulumi.AnyOutput {
    	panic(message)
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		caCerts, err := sql.GetCaCerts(ctx, &sql.GetCaCertsArgs{
    			Instance: "primary-database-server",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		furthestExpirationTime := notImplemented("reverse(sort([fork,vindata.google_sql_ca_certs.ca_certs.certs:v.expiration_time]))")[0]
    		latestCaCert := "TODO: For expression"
    		ctx.Export("dbLatestCaCert", latestCaCert)
    		return nil
    	})
    }
    

    Coming soon!

    import pulumi
    import pulumi_gcp as gcp
    
    
    def not_implemented(msg):
        raise NotImplementedError(msg)
    
    ca_certs = gcp.sql.get_ca_certs(instance="primary-database-server")
    furthest_expiration_time = not_implemented("reverse(sort([fork,vindata.google_sql_ca_certs.ca_certs.certs:v.expiration_time]))")[0]
    latest_ca_cert = [v.cert for v in ca_certs.certs if v.expiration_time == furthest_expiration_time]
    pulumi.export("dbLatestCaCert", latest_ca_cert)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    function notImplemented(message: string) {
        throw new Error(message);
    }
    
    const caCerts = gcp.sql.getCaCerts({
        instance: "primary-database-server",
    });
    const furthestExpirationTime = notImplemented("reverse(sort([fork,vindata.google_sql_ca_certs.ca_certs.certs:v.expiration_time]))")[0];
    const latestCaCert = caCerts.then(caCerts => .filter(v => v.expirationTime == furthestExpirationTime).map(v => (v.cert)));
    export const dbLatestCaCert = latestCaCert;
    

    Coming soon!

    Using getCaCerts

    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 getCaCerts(args: GetCaCertsArgs, opts?: InvokeOptions): Promise<GetCaCertsResult>
    function getCaCertsOutput(args: GetCaCertsOutputArgs, opts?: InvokeOptions): Output<GetCaCertsResult>
    def get_ca_certs(instance: Optional[str] = None,
                     project: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetCaCertsResult
    def get_ca_certs_output(instance: Optional[pulumi.Input[str]] = None,
                     project: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetCaCertsResult]
    func GetCaCerts(ctx *Context, args *GetCaCertsArgs, opts ...InvokeOption) (*GetCaCertsResult, error)
    func GetCaCertsOutput(ctx *Context, args *GetCaCertsOutputArgs, opts ...InvokeOption) GetCaCertsResultOutput

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

    public static class GetCaCerts 
    {
        public static Task<GetCaCertsResult> InvokeAsync(GetCaCertsArgs args, InvokeOptions? opts = null)
        public static Output<GetCaCertsResult> Invoke(GetCaCertsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCaCertsResult> getCaCerts(GetCaCertsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:sql/getCaCerts:getCaCerts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Instance string
    The name or self link of the instance.
    Project string
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.
    Instance string
    The name or self link of the instance.
    Project string
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.
    instance String
    The name or self link of the instance.
    project String
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.
    instance string
    The name or self link of the instance.
    project string
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.
    instance str
    The name or self link of the instance.
    project str
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.
    instance String
    The name or self link of the instance.
    project String
    The ID of the project in which the resource belongs. If project is not provided, the provider project is used.

    getCaCerts Result

    The following output properties are available:

    ActiveVersion string
    SHA1 fingerprint of the currently active CA certificate.
    Certs List<GetCaCertsCert>
    A list of server CA certificates for the instance. Each contains:
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Project string
    ActiveVersion string
    SHA1 fingerprint of the currently active CA certificate.
    Certs []GetCaCertsCert
    A list of server CA certificates for the instance. Each contains:
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Project string
    activeVersion String
    SHA1 fingerprint of the currently active CA certificate.
    certs List<GetCaCertsCert>
    A list of server CA certificates for the instance. Each contains:
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    project String
    activeVersion string
    SHA1 fingerprint of the currently active CA certificate.
    certs GetCaCertsCert[]
    A list of server CA certificates for the instance. Each contains:
    id string
    The provider-assigned unique ID for this managed resource.
    instance string
    project string
    active_version str
    SHA1 fingerprint of the currently active CA certificate.
    certs Sequence[GetCaCertsCert]
    A list of server CA certificates for the instance. Each contains:
    id str
    The provider-assigned unique ID for this managed resource.
    instance str
    project str
    activeVersion String
    SHA1 fingerprint of the currently active CA certificate.
    certs List<Property Map>
    A list of server CA certificates for the instance. Each contains:
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    project String

    Supporting Types

    GetCaCertsCert

    Cert string
    The CA certificate used to connect to the SQL instance via SSL.
    CommonName string
    The CN valid for the CA cert.
    CreateTime string
    Creation time of the CA cert.
    ExpirationTime string
    Expiration time of the CA cert.
    Sha1Fingerprint string
    SHA1 fingerprint of the CA cert.
    Cert string
    The CA certificate used to connect to the SQL instance via SSL.
    CommonName string
    The CN valid for the CA cert.
    CreateTime string
    Creation time of the CA cert.
    ExpirationTime string
    Expiration time of the CA cert.
    Sha1Fingerprint string
    SHA1 fingerprint of the CA cert.
    cert String
    The CA certificate used to connect to the SQL instance via SSL.
    commonName String
    The CN valid for the CA cert.
    createTime String
    Creation time of the CA cert.
    expirationTime String
    Expiration time of the CA cert.
    sha1Fingerprint String
    SHA1 fingerprint of the CA cert.
    cert string
    The CA certificate used to connect to the SQL instance via SSL.
    commonName string
    The CN valid for the CA cert.
    createTime string
    Creation time of the CA cert.
    expirationTime string
    Expiration time of the CA cert.
    sha1Fingerprint string
    SHA1 fingerprint of the CA cert.
    cert str
    The CA certificate used to connect to the SQL instance via SSL.
    common_name str
    The CN valid for the CA cert.
    create_time str
    Creation time of the CA cert.
    expiration_time str
    Expiration time of the CA cert.
    sha1_fingerprint str
    SHA1 fingerprint of the CA cert.
    cert String
    The CA certificate used to connect to the SQL instance via SSL.
    commonName String
    The CN valid for the CA cert.
    createTime String
    Creation time of the CA cert.
    expirationTime String
    Expiration time of the CA cert.
    sha1Fingerprint String
    SHA1 fingerprint of the CA cert.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi