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.RoleDefinitionArgs.builder
import com.pulumi.azure.authorization.kotlin.inputs.RoleDefinitionPermissionArgs
import com.pulumi.azure.authorization.kotlin.inputs.RoleDefinitionPermissionArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* 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"
* ```
* @property assignableScopes 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.
* @property description A description of the Role Definition.
* @property name The name of the Role Definition.
* @property permissions A `permissions` block as defined below.
* @property roleDefinitionId A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
* @property scope 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 data class RoleDefinitionArgs(
public val assignableScopes: Output>? = null,
public val description: Output? = null,
public val name: Output? = null,
public val permissions: Output>? = null,
public val roleDefinitionId: Output? = null,
public val scope: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.authorization.RoleDefinitionArgs =
com.pulumi.azure.authorization.RoleDefinitionArgs.builder()
.assignableScopes(assignableScopes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.description(description?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.permissions(
permissions?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.roleDefinitionId(roleDefinitionId?.applyValue({ args0 -> args0 }))
.scope(scope?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [RoleDefinitionArgs].
*/
@PulumiTagMarker
public class RoleDefinitionArgsBuilder internal constructor() {
private var assignableScopes: Output>? = null
private var description: Output? = null
private var name: Output? = null
private var permissions: Output>? = null
private var roleDefinitionId: Output? = null
private var scope: Output? = null
/**
* @param value 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.
*/
@JvmName("mwqnekoarnnkstqy")
public suspend fun assignableScopes(`value`: Output>) {
this.assignableScopes = value
}
@JvmName("vabfvsuwdgkhaiyk")
public suspend fun assignableScopes(vararg values: Output) {
this.assignableScopes = Output.all(values.asList())
}
/**
* @param values 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.
*/
@JvmName("vtlonklxvgccpaql")
public suspend fun assignableScopes(values: List