Class ServiceAccountFunctions


  • public final class ServiceAccountFunctions
    extends java.lang.Object
    • Constructor Detail

      • ServiceAccountFunctions

        public ServiceAccountFunctions()
    • Method Detail

      • getAccount

        public static com.pulumi.core.Output<GetAccountResult> getAccount​(GetAccountArgs args)
        Get the service account from a project. For more information see the official [API](https://cloud.google.com/compute/docs/access/service-accounts) documentation. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountArgs; 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 objectViewer = ServiceAccountFunctions.getAccount(GetAccountArgs.builder() .accountId("object-viewer") .build()); } } ```
      • getAccountPlain

        public static java.util.concurrent.CompletableFuture<GetAccountResult> getAccountPlain​(GetAccountPlainArgs args)
        Get the service account from a project. For more information see the official [API](https://cloud.google.com/compute/docs/access/service-accounts) documentation. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountArgs; 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 objectViewer = ServiceAccountFunctions.getAccount(GetAccountArgs.builder() .accountId("object-viewer") .build()); } } ```
      • getAccount

        public static com.pulumi.core.Output<GetAccountResult> getAccount​(GetAccountArgs args,
                                                                          com.pulumi.deployment.InvokeOptions options)
        Get the service account from a project. For more information see the official [API](https://cloud.google.com/compute/docs/access/service-accounts) documentation. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountArgs; 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 objectViewer = ServiceAccountFunctions.getAccount(GetAccountArgs.builder() .accountId("object-viewer") .build()); } } ```
      • getAccountPlain

        public static java.util.concurrent.CompletableFuture<GetAccountResult> getAccountPlain​(GetAccountPlainArgs args,
                                                                                               com.pulumi.deployment.InvokeOptions options)
        Get the service account from a project. For more information see the official [API](https://cloud.google.com/compute/docs/access/service-accounts) documentation. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountArgs; 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 objectViewer = ServiceAccountFunctions.getAccount(GetAccountArgs.builder() .accountId("object-viewer") .build()); } } ```
      • getAccountAccessToken

        public static com.pulumi.core.Output<GetAccountAccessTokenResult> getAccountAccessToken​(GetAccountAccessTokenArgs args)
        This data source provides a google `oauth2` `access_token` for a different service account than the one initially running the script. For more information see [the official documentation](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials) as well as [iamcredentials.generateAccessToken()](https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/generateAccessToken)
      • getAccountAccessTokenPlain

        public static java.util.concurrent.CompletableFuture<GetAccountAccessTokenResult> getAccountAccessTokenPlain​(GetAccountAccessTokenPlainArgs args)
        This data source provides a google `oauth2` `access_token` for a different service account than the one initially running the script. For more information see [the official documentation](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials) as well as [iamcredentials.generateAccessToken()](https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/generateAccessToken)
      • getAccountAccessToken

        public static com.pulumi.core.Output<GetAccountAccessTokenResult> getAccountAccessToken​(GetAccountAccessTokenArgs args,
                                                                                                com.pulumi.deployment.InvokeOptions options)
        This data source provides a google `oauth2` `access_token` for a different service account than the one initially running the script. For more information see [the official documentation](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials) as well as [iamcredentials.generateAccessToken()](https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/generateAccessToken)
      • getAccountAccessTokenPlain

        public static java.util.concurrent.CompletableFuture<GetAccountAccessTokenResult> getAccountAccessTokenPlain​(GetAccountAccessTokenPlainArgs args,
                                                                                                                     com.pulumi.deployment.InvokeOptions options)
        This data source provides a google `oauth2` `access_token` for a different service account than the one initially running the script. For more information see [the official documentation](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials) as well as [iamcredentials.generateAccessToken()](https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/generateAccessToken)
      • getAccountIdToken

        public static com.pulumi.core.Output<GetAccountIdTokenResult> getAccountIdToken​(GetAccountIdTokenArgs args)
        This data source provides a Google OpenID Connect (`oidc`) `id_token`. Tokens issued from this data source are typically used to call external services that accept OIDC tokens for authentication (e.g. [Google Cloud Run](https://cloud.google.com/run/docs/authenticating/service-to-service)). For more information see [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html#IDToken). ## Example Usage ### ServiceAccount JSON Credential File. `gcp.serviceAccount.getAccountIdToken` will use the configured provider credentials ### Service Account Impersonation. `gcp.serviceAccount.getAccountAccessToken` will use background impersonated credentials provided by `gcp.serviceAccount.getAccountAccessToken`. Note: to use the following, you must grant `target_service_account` the `roles/iam.serviceAccountTokenCreator` role on itself.
      • getAccountIdTokenPlain

        public static java.util.concurrent.CompletableFuture<GetAccountIdTokenResult> getAccountIdTokenPlain​(GetAccountIdTokenPlainArgs args)
        This data source provides a Google OpenID Connect (`oidc`) `id_token`. Tokens issued from this data source are typically used to call external services that accept OIDC tokens for authentication (e.g. [Google Cloud Run](https://cloud.google.com/run/docs/authenticating/service-to-service)). For more information see [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html#IDToken). ## Example Usage ### ServiceAccount JSON Credential File. `gcp.serviceAccount.getAccountIdToken` will use the configured provider credentials ### Service Account Impersonation. `gcp.serviceAccount.getAccountAccessToken` will use background impersonated credentials provided by `gcp.serviceAccount.getAccountAccessToken`. Note: to use the following, you must grant `target_service_account` the `roles/iam.serviceAccountTokenCreator` role on itself.
      • getAccountIdToken

        public static com.pulumi.core.Output<GetAccountIdTokenResult> getAccountIdToken​(GetAccountIdTokenArgs args,
                                                                                        com.pulumi.deployment.InvokeOptions options)
        This data source provides a Google OpenID Connect (`oidc`) `id_token`. Tokens issued from this data source are typically used to call external services that accept OIDC tokens for authentication (e.g. [Google Cloud Run](https://cloud.google.com/run/docs/authenticating/service-to-service)). For more information see [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html#IDToken). ## Example Usage ### ServiceAccount JSON Credential File. `gcp.serviceAccount.getAccountIdToken` will use the configured provider credentials ### Service Account Impersonation. `gcp.serviceAccount.getAccountAccessToken` will use background impersonated credentials provided by `gcp.serviceAccount.getAccountAccessToken`. Note: to use the following, you must grant `target_service_account` the `roles/iam.serviceAccountTokenCreator` role on itself.
      • getAccountIdTokenPlain

        public static java.util.concurrent.CompletableFuture<GetAccountIdTokenResult> getAccountIdTokenPlain​(GetAccountIdTokenPlainArgs args,
                                                                                                             com.pulumi.deployment.InvokeOptions options)
        This data source provides a Google OpenID Connect (`oidc`) `id_token`. Tokens issued from this data source are typically used to call external services that accept OIDC tokens for authentication (e.g. [Google Cloud Run](https://cloud.google.com/run/docs/authenticating/service-to-service)). For more information see [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html#IDToken). ## Example Usage ### ServiceAccount JSON Credential File. `gcp.serviceAccount.getAccountIdToken` will use the configured provider credentials ### Service Account Impersonation. `gcp.serviceAccount.getAccountAccessToken` will use background impersonated credentials provided by `gcp.serviceAccount.getAccountAccessToken`. Note: to use the following, you must grant `target_service_account` the `roles/iam.serviceAccountTokenCreator` role on itself.
      • getAccountJwt

        public static com.pulumi.core.Output<GetAccountJwtResult> getAccountJwt​(GetAccountJwtArgs args)
        This data source provides a [self-signed JWT](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-jwt). Tokens issued from this data source are typically used to call external services that accept JWTs for authentication. ## Example Usage Note: in order to use the following, the caller must have _at least_ `roles/iam.serviceAccountTokenCreator` on the `target_service_account`. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountJwtArgs; import static com.pulumi.codegen.internal.Serialization.*; 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 foo = ServiceAccountFunctions.getAccountJwt(GetAccountJwtArgs.builder() .targetServiceAccount("[email protected]") .payload(serializeJson( jsonObject( jsonProperty("foo", "bar"), jsonProperty("sub", "subject") ))) .expiresIn(60) .build()); ctx.export("jwt", foo.applyValue(getAccountJwtResult -> getAccountJwtResult.jwt())); } } ```
      • getAccountJwtPlain

        public static java.util.concurrent.CompletableFuture<GetAccountJwtResult> getAccountJwtPlain​(GetAccountJwtPlainArgs args)
        This data source provides a [self-signed JWT](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-jwt). Tokens issued from this data source are typically used to call external services that accept JWTs for authentication. ## Example Usage Note: in order to use the following, the caller must have _at least_ `roles/iam.serviceAccountTokenCreator` on the `target_service_account`. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountJwtArgs; import static com.pulumi.codegen.internal.Serialization.*; 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 foo = ServiceAccountFunctions.getAccountJwt(GetAccountJwtArgs.builder() .targetServiceAccount("[email protected]") .payload(serializeJson( jsonObject( jsonProperty("foo", "bar"), jsonProperty("sub", "subject") ))) .expiresIn(60) .build()); ctx.export("jwt", foo.applyValue(getAccountJwtResult -> getAccountJwtResult.jwt())); } } ```
      • getAccountJwt

        public static com.pulumi.core.Output<GetAccountJwtResult> getAccountJwt​(GetAccountJwtArgs args,
                                                                                com.pulumi.deployment.InvokeOptions options)
        This data source provides a [self-signed JWT](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-jwt). Tokens issued from this data source are typically used to call external services that accept JWTs for authentication. ## Example Usage Note: in order to use the following, the caller must have _at least_ `roles/iam.serviceAccountTokenCreator` on the `target_service_account`. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountJwtArgs; import static com.pulumi.codegen.internal.Serialization.*; 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 foo = ServiceAccountFunctions.getAccountJwt(GetAccountJwtArgs.builder() .targetServiceAccount("[email protected]") .payload(serializeJson( jsonObject( jsonProperty("foo", "bar"), jsonProperty("sub", "subject") ))) .expiresIn(60) .build()); ctx.export("jwt", foo.applyValue(getAccountJwtResult -> getAccountJwtResult.jwt())); } } ```
      • getAccountJwtPlain

        public static java.util.concurrent.CompletableFuture<GetAccountJwtResult> getAccountJwtPlain​(GetAccountJwtPlainArgs args,
                                                                                                     com.pulumi.deployment.InvokeOptions options)
        This data source provides a [self-signed JWT](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-jwt). Tokens issued from this data source are typically used to call external services that accept JWTs for authentication. ## Example Usage Note: in order to use the following, the caller must have _at least_ `roles/iam.serviceAccountTokenCreator` on the `target_service_account`. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountJwtArgs; import static com.pulumi.codegen.internal.Serialization.*; 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 foo = ServiceAccountFunctions.getAccountJwt(GetAccountJwtArgs.builder() .targetServiceAccount("[email protected]") .payload(serializeJson( jsonObject( jsonProperty("foo", "bar"), jsonProperty("sub", "subject") ))) .expiresIn(60) .build()); ctx.export("jwt", foo.applyValue(getAccountJwtResult -> getAccountJwtResult.jwt())); } } ```
      • getAccountKey

        public static com.pulumi.core.Output<GetAccountKeyResult> getAccountKey​(GetAccountKeyArgs args)
        Get service account public key. For more information, see [the official documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and [API](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts.keys/get). ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.Account; import com.pulumi.gcp.serviceAccount.AccountArgs; import com.pulumi.gcp.serviceAccount.Key; import com.pulumi.gcp.serviceAccount.KeyArgs; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountKeyArgs; 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) { var myaccount = new Account("myaccount", AccountArgs.builder() .accountId("dev-foo-account") .build()); var mykeyKey = new Key("mykeyKey", KeyArgs.builder() .serviceAccountId(myaccount.name()) .build()); final var mykeyAccountKey = ServiceAccountFunctions.getAccountKey(GetAccountKeyArgs.builder() .name(mykeyKey.name()) .publicKeyType("TYPE_X509_PEM_FILE") .build()); } } ```
      • getAccountKeyPlain

        public static java.util.concurrent.CompletableFuture<GetAccountKeyResult> getAccountKeyPlain​(GetAccountKeyPlainArgs args)
        Get service account public key. For more information, see [the official documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and [API](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts.keys/get). ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.Account; import com.pulumi.gcp.serviceAccount.AccountArgs; import com.pulumi.gcp.serviceAccount.Key; import com.pulumi.gcp.serviceAccount.KeyArgs; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountKeyArgs; 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) { var myaccount = new Account("myaccount", AccountArgs.builder() .accountId("dev-foo-account") .build()); var mykeyKey = new Key("mykeyKey", KeyArgs.builder() .serviceAccountId(myaccount.name()) .build()); final var mykeyAccountKey = ServiceAccountFunctions.getAccountKey(GetAccountKeyArgs.builder() .name(mykeyKey.name()) .publicKeyType("TYPE_X509_PEM_FILE") .build()); } } ```
      • getAccountKey

        public static com.pulumi.core.Output<GetAccountKeyResult> getAccountKey​(GetAccountKeyArgs args,
                                                                                com.pulumi.deployment.InvokeOptions options)
        Get service account public key. For more information, see [the official documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and [API](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts.keys/get). ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.Account; import com.pulumi.gcp.serviceAccount.AccountArgs; import com.pulumi.gcp.serviceAccount.Key; import com.pulumi.gcp.serviceAccount.KeyArgs; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountKeyArgs; 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) { var myaccount = new Account("myaccount", AccountArgs.builder() .accountId("dev-foo-account") .build()); var mykeyKey = new Key("mykeyKey", KeyArgs.builder() .serviceAccountId(myaccount.name()) .build()); final var mykeyAccountKey = ServiceAccountFunctions.getAccountKey(GetAccountKeyArgs.builder() .name(mykeyKey.name()) .publicKeyType("TYPE_X509_PEM_FILE") .build()); } } ```
      • getAccountKeyPlain

        public static java.util.concurrent.CompletableFuture<GetAccountKeyResult> getAccountKeyPlain​(GetAccountKeyPlainArgs args,
                                                                                                     com.pulumi.deployment.InvokeOptions options)
        Get service account public key. For more information, see [the official documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and [API](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts.keys/get). ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.serviceAccount.Account; import com.pulumi.gcp.serviceAccount.AccountArgs; import com.pulumi.gcp.serviceAccount.Key; import com.pulumi.gcp.serviceAccount.KeyArgs; import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions; import com.pulumi.gcp.serviceAccount.inputs.GetAccountKeyArgs; 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) { var myaccount = new Account("myaccount", AccountArgs.builder() .accountId("dev-foo-account") .build()); var mykeyKey = new Key("mykeyKey", KeyArgs.builder() .serviceAccountId(myaccount.name()) .build()); final var mykeyAccountKey = ServiceAccountFunctions.getAccountKey(GetAccountKeyArgs.builder() .name(mykeyKey.name()) .publicKeyType("TYPE_X509_PEM_FILE") .build()); } } ```