All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.projects.kotlin.ProjectsFunctions.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.projects.kotlin
import com.pulumi.gcp.projects.ProjectsFunctions.getIamPolicyPlain
import com.pulumi.gcp.projects.ProjectsFunctions.getOrganizationPolicyPlain
import com.pulumi.gcp.projects.ProjectsFunctions.getProjectPlain
import com.pulumi.gcp.projects.ProjectsFunctions.getProjectServicePlain
import com.pulumi.gcp.projects.kotlin.inputs.GetIamPolicyPlainArgs
import com.pulumi.gcp.projects.kotlin.inputs.GetIamPolicyPlainArgsBuilder
import com.pulumi.gcp.projects.kotlin.inputs.GetOrganizationPolicyPlainArgs
import com.pulumi.gcp.projects.kotlin.inputs.GetOrganizationPolicyPlainArgsBuilder
import com.pulumi.gcp.projects.kotlin.inputs.GetProjectPlainArgs
import com.pulumi.gcp.projects.kotlin.inputs.GetProjectPlainArgsBuilder
import com.pulumi.gcp.projects.kotlin.inputs.GetProjectServicePlainArgs
import com.pulumi.gcp.projects.kotlin.inputs.GetProjectServicePlainArgsBuilder
import com.pulumi.gcp.projects.kotlin.outputs.GetIamPolicyResult
import com.pulumi.gcp.projects.kotlin.outputs.GetOrganizationPolicyResult
import com.pulumi.gcp.projects.kotlin.outputs.GetProjectResult
import com.pulumi.gcp.projects.kotlin.outputs.GetProjectServiceResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.projects.kotlin.outputs.GetIamPolicyResult.Companion.toKotlin as getIamPolicyResultToKotlin
import com.pulumi.gcp.projects.kotlin.outputs.GetOrganizationPolicyResult.Companion.toKotlin as getOrganizationPolicyResultToKotlin
import com.pulumi.gcp.projects.kotlin.outputs.GetProjectResult.Companion.toKotlin as getProjectResultToKotlin
import com.pulumi.gcp.projects.kotlin.outputs.GetProjectServiceResult.Companion.toKotlin as getProjectServiceResultToKotlin
public object ProjectsFunctions {
/**
* Retrieves the current IAM policy data for a project.
* ## example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const policy = gcp.projects.getIamPolicy({
* project: "myproject",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* policy = gcp.projects.get_iam_policy(project="myproject")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var policy = Gcp.Projects.GetIamPolicy.Invoke(new()
* {
* Project = "myproject",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := projects.GetIamPolicy(ctx, &projects.GetIamPolicyArgs{
* Project: "myproject",
* }, nil)
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.ProjectsFunctions;
* import com.pulumi.gcp.projects.inputs.GetIamPolicyArgs;
* 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 policy = ProjectsFunctions.getIamPolicy(GetIamPolicyArgs.builder()
* .project("myproject")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* policy:
* fn::invoke:
* Function: gcp:projects:getIamPolicy
* Arguments:
* project: myproject
* ```
*
* @param argument A collection of arguments for invoking getIamPolicy.
* @return A collection of values returned by getIamPolicy.
*/
public suspend fun getIamPolicy(argument: GetIamPolicyPlainArgs): GetIamPolicyResult =
getIamPolicyResultToKotlin(getIamPolicyPlain(argument.toJava()).await())
/**
* @see [getIamPolicy].
* @param project The project id of the target project. This is not
* inferred from the provider.
* @return A collection of values returned by getIamPolicy.
*/
public suspend fun getIamPolicy(project: String): GetIamPolicyResult {
val argument = GetIamPolicyPlainArgs(
project = project,
)
return getIamPolicyResultToKotlin(getIamPolicyPlain(argument.toJava()).await())
}
/**
* @see [getIamPolicy].
* @param argument Builder for [com.pulumi.gcp.projects.kotlin.inputs.GetIamPolicyPlainArgs].
* @return A collection of values returned by getIamPolicy.
*/
public suspend fun getIamPolicy(argument: suspend GetIamPolicyPlainArgsBuilder.() -> Unit): GetIamPolicyResult {
val builder = GetIamPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getIamPolicyResultToKotlin(getIamPolicyPlain(builtArgument.toJava()).await())
}
/**
* Allows management of Organization policies for a Google Project. For more information see
* [the official
* documentation](https://cloud.google.com/resource-manager/docs/organization-policy/overview)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const policy = gcp.projects.getOrganizationPolicy({
* project: "project-id",
* constraint: "constraints/serviceuser.services",
* });
* export const version = policy.then(policy => policy.version);
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* policy = gcp.projects.get_organization_policy(project="project-id",
* constraint="constraints/serviceuser.services")
* pulumi.export("version", policy.version)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var policy = Gcp.Projects.GetOrganizationPolicy.Invoke(new()
* {
* Project = "project-id",
* Constraint = "constraints/serviceuser.services",
* });
* return new Dictionary
* {
* ["version"] = policy.Apply(getOrganizationPolicyResult => getOrganizationPolicyResult.Version),
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* policy, err := projects.LookupOrganizationPolicy(ctx, &projects.LookupOrganizationPolicyArgs{
* Project: "project-id",
* Constraint: "constraints/serviceuser.services",
* }, nil)
* if err != nil {
* return err
* }
* ctx.Export("version", policy.Version)
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.ProjectsFunctions;
* import com.pulumi.gcp.projects.inputs.GetOrganizationPolicyArgs;
* 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 policy = ProjectsFunctions.getOrganizationPolicy(GetOrganizationPolicyArgs.builder()
* .project("project-id")
* .constraint("constraints/serviceuser.services")
* .build());
* ctx.export("version", policy.applyValue(getOrganizationPolicyResult -> getOrganizationPolicyResult.version()));
* }
* }
* ```
* ```yaml
* variables:
* policy:
* fn::invoke:
* Function: gcp:projects:getOrganizationPolicy
* Arguments:
* project: project-id
* constraint: constraints/serviceuser.services
* outputs:
* version: ${policy.version}
* ```
*
* @param argument A collection of arguments for invoking getOrganizationPolicy.
* @return A collection of values returned by getOrganizationPolicy.
*/
public suspend fun getOrganizationPolicy(argument: GetOrganizationPolicyPlainArgs): GetOrganizationPolicyResult =
getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(argument.toJava()).await())
/**
* @see [getOrganizationPolicy].
* @param constraint (Required) The name of the Constraint the Policy is configuring, for example, `serviceuser.services`. Check out the [complete list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints#available_constraints).
* @param project The project ID.
* @return A collection of values returned by getOrganizationPolicy.
*/
public suspend fun getOrganizationPolicy(constraint: String, project: String): GetOrganizationPolicyResult {
val argument = GetOrganizationPolicyPlainArgs(
constraint = constraint,
project = project,
)
return getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(argument.toJava()).await())
}
/**
* @see [getOrganizationPolicy].
* @param argument Builder for [com.pulumi.gcp.projects.kotlin.inputs.GetOrganizationPolicyPlainArgs].
* @return A collection of values returned by getOrganizationPolicy.
*/
public suspend fun getOrganizationPolicy(argument: suspend GetOrganizationPolicyPlainArgsBuilder.() -> Unit): GetOrganizationPolicyResult {
val builder = GetOrganizationPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(builtArgument.toJava()).await())
}
/**
* Retrieve information about a set of projects based on a filter. See the
* [REST API](https://cloud.google.com/resource-manager/reference/rest/v1/projects/list)
* for more details.
* ## Example Usage
* ### Searching For Projects About To Be Deleted In An Org
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my-org-projects = gcp.projects.getProject({
* filter: "parent.id:012345678910 lifecycleState:DELETE_REQUESTED",
* });
* const deletion-candidate = my_org_projects.then(my_org_projects => gcp.organizations.getProject({
* projectId: my_org_projects.projects?.[0]?.projectId,
* }));
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_org_projects = gcp.projects.get_project(filter="parent.id:012345678910 lifecycleState:DELETE_REQUESTED")
* deletion_candidate = gcp.organizations.get_project(project_id=my_org_projects.projects[0].project_id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_org_projects = Gcp.Projects.GetProject.Invoke(new()
* {
* Filter = "parent.id:012345678910 lifecycleState:DELETE_REQUESTED",
* });
* var deletion_candidate = Gcp.Organizations.GetProject.Invoke(new()
* {
* ProjectId = my_org_projects.Apply(getProjectResult => getProjectResult.Projects[0]?.ProjectId),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* my_org_projects, err := projects.GetProject(ctx, &projects.GetProjectArgs{
* Filter: "parent.id:012345678910 lifecycleState:DELETE_REQUESTED",
* }, nil)
* if err != nil {
* return err
* }
* _, err = organizations.LookupProject(ctx, &organizations.LookupProjectArgs{
* ProjectId: pulumi.StringRef(my_org_projects.Projects[0].ProjectId),
* }, nil)
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.ProjectsFunctions;
* import com.pulumi.gcp.projects.inputs.GetProjectArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* 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 my-org-projects = ProjectsFunctions.getProject(GetProjectArgs.builder()
* .filter("parent.id:012345678910 lifecycleState:DELETE_REQUESTED")
* .build());
* final var deletion-candidate = OrganizationsFunctions.getProject(GetProjectArgs.builder()
* .projectId(my_org_projects.projects()[0].projectId())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* my-org-projects:
* fn::invoke:
* Function: gcp:projects:getProject
* Arguments:
* filter: parent.id:012345678910 lifecycleState:DELETE_REQUESTED
* deletion-candidate:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments:
* projectId: ${["my-org-projects"].projects[0].projectId}
* ```
*
* @param argument A collection of arguments for invoking getProject.
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(argument: GetProjectPlainArgs): GetProjectResult =
getProjectResultToKotlin(getProjectPlain(argument.toJava()).await())
/**
* @see [getProject].
* @param filter A string filter as defined in the [REST API](https://cloud.google.com/resource-manager/reference/rest/v1/projects/list#query-parameters).
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(filter: String): GetProjectResult {
val argument = GetProjectPlainArgs(
filter = filter,
)
return getProjectResultToKotlin(getProjectPlain(argument.toJava()).await())
}
/**
* @see [getProject].
* @param argument Builder for [com.pulumi.gcp.projects.kotlin.inputs.GetProjectPlainArgs].
* @return A collection of values returned by getProject.
*/
public suspend fun getProject(argument: suspend GetProjectPlainArgsBuilder.() -> Unit): GetProjectResult {
val builder = GetProjectPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getProjectResultToKotlin(getProjectPlain(builtArgument.toJava()).await())
}
/**
* Verify the API service for the Google Cloud Platform project to see if it is enabled or not.
* For a list of services available, visit the [API library page](https://console.cloud.google.com/apis/library)
* or run `gcloud services list --available`.
* This datasource requires the [Service Usage API](https://console.cloud.google.com/apis/library/serviceusage.googleapis.com)
* to use.
* To get more information about `gcp.projects.Service`, see:
* * [API documentation](https://cloud.google.com/service-usage/docs/reference/rest/v1/services)
* * How-to Guides
* * [Enabling and Disabling Services](https://cloud.google.com/service-usage/docs/enable-disable)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const my-project-service = gcp.projects.getProjectService({
* service: "my-project-service",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_project_service = gcp.projects.get_project_service(service="my-project-service")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var my_project_service = Gcp.Projects.GetProjectService.Invoke(new()
* {
* Service = "my-project-service",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := projects.GetProjectService(ctx, &projects.GetProjectServiceArgs{
* Service: "my-project-service",
* }, nil)
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.ProjectsFunctions;
* import com.pulumi.gcp.projects.inputs.GetProjectServiceArgs;
* 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 my-project-service = ProjectsFunctions.getProjectService(GetProjectServiceArgs.builder()
* .service("my-project-service")
* .build());
* }
* }
* ```
* ```yaml
* variables:
* my-project-service:
* fn::invoke:
* Function: gcp:projects:getProjectService
* Arguments:
* service: my-project-service
* ```
*
* @param argument A collection of arguments for invoking getProjectService.
* @return A collection of values returned by getProjectService.
*/
public suspend fun getProjectService(argument: GetProjectServicePlainArgs): GetProjectServiceResult =
getProjectServiceResultToKotlin(getProjectServicePlain(argument.toJava()).await())
/**
* @see [getProjectService].
* @param project The project in which the resource belongs. If it
* is not provided, the provider project is used.
* @param service The name of the Google Platform project service.
* - - -
* @return A collection of values returned by getProjectService.
*/
public suspend fun getProjectService(project: String? = null, service: String): GetProjectServiceResult {
val argument = GetProjectServicePlainArgs(
project = project,
service = service,
)
return getProjectServiceResultToKotlin(getProjectServicePlain(argument.toJava()).await())
}
/**
* @see [getProjectService].
* @param argument Builder for [com.pulumi.gcp.projects.kotlin.inputs.GetProjectServicePlainArgs].
* @return A collection of values returned by getProjectService.
*/
public suspend fun getProjectService(argument: suspend GetProjectServicePlainArgsBuilder.() -> Unit): GetProjectServiceResult {
val builder = GetProjectServicePlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return getProjectServiceResultToKotlin(getProjectServicePlain(builtArgument.toJava()).await())
}
}