com.pulumi.gcp.projects.kotlin.IamMemberRemove.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.projects.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [IamMemberRemove].
*/
@PulumiTagMarker
public class IamMemberRemoveResourceBuilder internal constructor() {
public var name: String? = null
public var args: IamMemberRemoveArgs = IamMemberRemoveArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend IamMemberRemoveArgsBuilder.() -> Unit) {
val builder = IamMemberRemoveArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): IamMemberRemove {
val builtJavaResource = com.pulumi.gcp.projects.IamMemberRemove(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return IamMemberRemove(builtJavaResource)
}
}
/**
* Ensures that a member:role pairing does not exist in a project's IAM policy.
* On create, this resource will modify the policy to remove the `member` from the
* `role`. If the membership is ever re-added, the next refresh will clear this
* resource from state, proposing re-adding it to correct the membership. Import is
* not supported- this resource will acquire the current policy and modify it as
* part of creating the resource.
* This resource will conflict with `gcp.projects.IAMPolicy` and
* `gcp.projects.IAMBinding` resources that share a role, as well as
* `gcp.projects.IAMMember` resources that target the same membership. When
* multiple resources conflict the final state is not guaranteed to include or omit
* the membership. Subsequent `pulumi up` calls will always show a diff
* until the configuration is corrected.
* For more information see
* [the official documentation](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
* and
* [API reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects/setIamPolicy).
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const targetProject = gcp.organizations.getProject({});
* const foo = new gcp.projects.IamMemberRemove("foo", {
* role: "roles/editor",
* project: targetProjectGoogleProject.projectId,
* member: `serviceAccount:${targetProjectGoogleProject.number}[email protected]`,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* target_project = gcp.organizations.get_project()
* foo = gcp.projects.IamMemberRemove("foo",
* role="roles/editor",
* project=target_project_google_project["projectId"],
* member=f"serviceAccount:{target_project_google_project['number']}[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var targetProject = Gcp.Organizations.GetProject.Invoke();
* var foo = new Gcp.Projects.IamMemberRemove("foo", new()
* {
* Role = "roles/editor",
* Project = targetProjectGoogleProject.ProjectId,
* Member = $"serviceAccount:{targetProjectGoogleProject.Number}[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
* if err != nil {
* return err
* }
* _, err = projects.NewIamMemberRemove(ctx, "foo", &projects.IamMemberRemoveArgs{
* Role: pulumi.String("roles/editor"),
* Project: pulumi.Any(targetProjectGoogleProject.ProjectId),
* Member: pulumi.Sprintf("serviceAccount:%[email protected]", targetProjectGoogleProject.Number),
* })
* 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.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.projects.IamMemberRemove;
* import com.pulumi.gcp.projects.IamMemberRemoveArgs;
* 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 targetProject = OrganizationsFunctions.getProject();
* var foo = new IamMemberRemove("foo", IamMemberRemoveArgs.builder()
* .role("roles/editor")
* .project(targetProjectGoogleProject.projectId())
* .member(String.format("serviceAccount:%[email protected]", targetProjectGoogleProject.number()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foo:
* type: gcp:projects:IamMemberRemove
* properties:
* role: roles/editor
* project: ${targetProjectGoogleProject.projectId}
* member: serviceAccount:${targetProjectGoogleProject.number}[email protected]
* variables:
* targetProject:
* fn::invoke:
* function: gcp:organizations:getProject
* arguments: {}
* ```
*
*/
public class IamMemberRemove internal constructor(
override val javaResource: com.pulumi.gcp.projects.IamMemberRemove,
) : KotlinCustomResource(javaResource, IamMemberRemoveMapper) {
/**
* The IAM principal that should not have the target role.
* Each entry can have one of the following values:
* * **user:{emailid}**: An email address that represents a specific Google account. For example, [email protected] or [email protected].
* * **serviceAccount:{emailid}**: An email address that represents a service account. For example, [email protected].
* * **group:{emailid}**: An email address that represents a Google group. For example, [email protected].
* * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
*/
public val member: Output
get() = javaResource.member().applyValue({ args0 -> args0 })
/**
* The project id of the target project.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The target role that should be removed.
*/
public val role: Output
get() = javaResource.role().applyValue({ args0 -> args0 })
}
public object IamMemberRemoveMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.projects.IamMemberRemove::class == javaResource::class
override fun map(javaResource: Resource): IamMemberRemove = IamMemberRemove(
javaResource as
com.pulumi.gcp.projects.IamMemberRemove,
)
}
/**
* @see [IamMemberRemove].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [IamMemberRemove].
*/
public suspend fun iamMemberRemove(
name: String,
block: suspend IamMemberRemoveResourceBuilder.() -> Unit,
): IamMemberRemove {
val builder = IamMemberRemoveResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [IamMemberRemove].
* @param name The _unique_ name of the resulting resource.
*/
public fun iamMemberRemove(name: String): IamMemberRemove {
val builder = IamMemberRemoveResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy