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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.authorization.kotlin
import com.pulumi.azure.authorization.kotlin.outputs.RoleDefinitionPermission
import com.pulumi.azure.authorization.kotlin.outputs.RoleDefinitionPermission.Companion.toKotlin
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
import kotlin.collections.List
/**
* Builder for [RoleDefinition].
*/
@PulumiTagMarker
public class RoleDefinitionResourceBuilder internal constructor() {
public var name: String? = null
public var args: RoleDefinitionArgs = RoleDefinitionArgs()
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 RoleDefinitionArgsBuilder.() -> Unit) {
val builder = RoleDefinitionArgsBuilder()
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(): RoleDefinition {
val builtJavaResource = com.pulumi.azure.authorization.RoleDefinition(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RoleDefinition(builtJavaResource)
}
}
/**
* Manages a custom Role Definition, used to assign Roles to Users/Principals. See ['Understand role definitions'](https://docs.microsoft.com/azure/role-based-access-control/role-definitions) in the Azure documentation for more details.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const primary = azure.core.getSubscription({});
* const example = new azure.authorization.RoleDefinition("example", {
* name: "my-custom-role",
* scope: primary.then(primary => primary.id),
* description: "This is a custom role created",
* permissions: [{
* actions: ["*"],
* notActions: [],
* }],
* assignableScopes: [primary.then(primary => primary.id)],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* primary = azure.core.get_subscription()
* example = azure.authorization.RoleDefinition("example",
* name="my-custom-role",
* scope=primary.id,
* description="This is a custom role created",
* permissions=[{
* "actions": ["*"],
* "not_actions": [],
* }],
* assignable_scopes=[primary.id])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var primary = Azure.Core.GetSubscription.Invoke();
* var example = new Azure.Authorization.RoleDefinition("example", new()
* {
* Name = "my-custom-role",
* Scope = primary.Apply(getSubscriptionResult => getSubscriptionResult.Id),
* Description = "This is a custom role created",
* Permissions = new[]
* {
* new Azure.Authorization.Inputs.RoleDefinitionPermissionArgs
* {
* Actions = new[]
* {
* "*",
* },
* NotActions = new() { },
* },
* },
* AssignableScopes = new[]
* {
* primary.Apply(getSubscriptionResult => getSubscriptionResult.Id),
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := core.LookupSubscription(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = authorization.NewRoleDefinition(ctx, "example", &authorization.RoleDefinitionArgs{
* Name: pulumi.String("my-custom-role"),
* Scope: pulumi.String(primary.Id),
* Description: pulumi.String("This is a custom role created"),
* Permissions: authorization.RoleDefinitionPermissionArray{
* &authorization.RoleDefinitionPermissionArgs{
* Actions: pulumi.StringArray{
* pulumi.String("*"),
* },
* NotActions: pulumi.StringArray{},
* },
* },
* AssignableScopes: pulumi.StringArray{
* pulumi.String(primary.Id),
* },
* })
* 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.azure.core.CoreFunctions;
* import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
* import com.pulumi.azure.authorization.RoleDefinition;
* import com.pulumi.azure.authorization.RoleDefinitionArgs;
* import com.pulumi.azure.authorization.inputs.RoleDefinitionPermissionArgs;
* 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 primary = CoreFunctions.getSubscription();
* var example = new RoleDefinition("example", RoleDefinitionArgs.builder()
* .name("my-custom-role")
* .scope(primary.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
* .description("This is a custom role created")
* .permissions(RoleDefinitionPermissionArgs.builder()
* .actions("*")
* .notActions()
* .build())
* .assignableScopes(primary.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:authorization:RoleDefinition
* properties:
* name: my-custom-role
* scope: ${primary.id}
* description: This is a custom role created
* permissions:
* - actions:
* - '*'
* notActions: []
* assignableScopes:
* - ${primary.id}
* variables:
* primary:
* fn::invoke:
* Function: azure:core:getSubscription
* Arguments: {}
* ```
*
* ## Import
* Role Definitions can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:authorization/roleDefinition:RoleDefinition example "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/00000000-0000-0000-0000-000000000000|/subscriptions/00000000-0000-0000-0000-000000000000"
* ```
*/
public class RoleDefinition internal constructor(
override val javaResource: com.pulumi.azure.authorization.RoleDefinition,
) : KotlinCustomResource(javaResource, RoleDefinitionMapper) {
/**
* One or more assignable scopes for this Role Definition, such as `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333`, `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup`, or `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM`.
* > **NOTE:** The value for `scope` is automatically included in this list if no other values supplied.
*/
public val assignableScopes: Output>
get() = javaResource.assignableScopes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* A description of the Role Definition.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The name of the Role Definition.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A `permissions` block as defined below.
*/
public val permissions: Output>?
get() = javaResource.permissions().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
}).orElse(null)
})
/**
* A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
*/
public val roleDefinitionId: Output
get() = javaResource.roleDefinitionId().applyValue({ args0 -> args0 })
/**
* The Azure Resource Manager ID for the resource.
*/
public val roleDefinitionResourceId: Output
get() = javaResource.roleDefinitionResourceId().applyValue({ args0 -> args0 })
/**
* The scope at which the Role Definition applies to, such as `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333`, `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup`, or `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM`. It is recommended to use the first entry of the `assignable_scopes`. Changing this forces a new resource to be created.
*/
public val scope: Output
get() = javaResource.scope().applyValue({ args0 -> args0 })
}
public object RoleDefinitionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.authorization.RoleDefinition::class == javaResource::class
override fun map(javaResource: Resource): RoleDefinition = RoleDefinition(
javaResource as
com.pulumi.azure.authorization.RoleDefinition,
)
}
/**
* @see [RoleDefinition].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RoleDefinition].
*/
public suspend fun roleDefinition(
name: String,
block: suspend RoleDefinitionResourceBuilder.() -> Unit,
): RoleDefinition {
val builder = RoleDefinitionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RoleDefinition].
* @param name The _unique_ name of the resulting resource.
*/
public fun roleDefinition(name: String): RoleDefinition {
val builder = RoleDefinitionResourceBuilder()
builder.name(name)
return builder.build()
}