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.azure.pim.kotlin.PimFunctions.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.pim.kotlin
import com.pulumi.azure.pim.PimFunctions.getRoleManagementPolicyPlain
import com.pulumi.azure.pim.kotlin.inputs.GetRoleManagementPolicyPlainArgs
import com.pulumi.azure.pim.kotlin.inputs.GetRoleManagementPolicyPlainArgsBuilder
import com.pulumi.azure.pim.kotlin.outputs.GetRoleManagementPolicyResult
import com.pulumi.azure.pim.kotlin.outputs.GetRoleManagementPolicyResult.Companion.toKotlin
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
public object PimFunctions {
/**
* Use this data source to get information on a role policy for an Azure Management Group, Subscription, Resource Group or resource.
* ## Example Usage
* ### Resource Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = azure.core.getResourceGroup({
* name: "example-rg",
* });
* const rgContributor = example.then(example => azure.authorization.getRoleDefinition({
* name: "Contributor",
* scope: example.id,
* }));
* const exampleGetRoleManagementPolicy = azure.pim.getRoleManagementPolicy({
* scope: test.id,
* roleDefinitionId: contributor.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.get_resource_group(name="example-rg")
* rg_contributor = azure.authorization.get_role_definition(name="Contributor",
* scope=example.id)
* example_get_role_management_policy = azure.pim.get_role_management_policy(scope=test["id"],
* role_definition_id=contributor["id"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = Azure.Core.GetResourceGroup.Invoke(new()
* {
* Name = "example-rg",
* });
* var rgContributor = Azure.Authorization.GetRoleDefinition.Invoke(new()
* {
* Name = "Contributor",
* Scope = example.Apply(getResourceGroupResult => getResourceGroupResult.Id),
* });
* var exampleGetRoleManagementPolicy = Azure.Pim.GetRoleManagementPolicy.Invoke(new()
* {
* Scope = test.Id,
* RoleDefinitionId = contributor.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-azure/sdk/v5/go/azure/pim"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.LookupResourceGroup(ctx, &core.LookupResourceGroupArgs{
* Name: "example-rg",
* }, nil)
* if err != nil {
* return err
* }
* _, err = authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
* Name: pulumi.StringRef("Contributor"),
* Scope: pulumi.StringRef(example.Id),
* }, nil)
* if err != nil {
* return err
* }
* _, err = pim.LookupRoleManagementPolicy(ctx, &pim.LookupRoleManagementPolicyArgs{
* Scope: test.Id,
* RoleDefinitionId: contributor.Id,
* }, 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.azure.core.CoreFunctions;
* import com.pulumi.azure.core.inputs.GetResourceGroupArgs;
* import com.pulumi.azure.authorization.AuthorizationFunctions;
* import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
* import com.pulumi.azure.pim.PimFunctions;
* import com.pulumi.azure.pim.inputs.GetRoleManagementPolicyArgs;
* 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 example = CoreFunctions.getResourceGroup(GetResourceGroupArgs.builder()
* .name("example-rg")
* .build());
* final var rgContributor = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
* .name("Contributor")
* .scope(example.applyValue(getResourceGroupResult -> getResourceGroupResult.id()))
* .build());
* final var exampleGetRoleManagementPolicy = PimFunctions.getRoleManagementPolicy(GetRoleManagementPolicyArgs.builder()
* .scope(test.id())
* .roleDefinitionId(contributor.id())
* .build());
* }
* }
* ```
* ```yaml
* variables:
* example:
* fn::invoke:
* Function: azure:core:getResourceGroup
* Arguments:
* name: example-rg
* rgContributor:
* fn::invoke:
* Function: azure:authorization:getRoleDefinition
* Arguments:
* name: Contributor
* scope: ${example.id}
* exampleGetRoleManagementPolicy:
* fn::invoke:
* Function: azure:pim:getRoleManagementPolicy
* Arguments:
* scope: ${test.id}
* roleDefinitionId: ${contributor.id}
* ```
*
* ### Management Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = azure.management.getGroup({
* name: "example-group",
* });
* const mgContributor = azure.authorization.getRoleDefinition({
* name: "Contributor",
* scope: exampleAzurermManagementGroup.id,
* });
* const exampleGetRoleManagementPolicy = Promise.all([example, mgContributor]).then(([example, mgContributor]) => azure.pim.getRoleManagementPolicy({
* scope: example.id,
* roleDefinitionId: mgContributor.id,
* }));
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.management.get_group(name="example-group")
* mg_contributor = azure.authorization.get_role_definition(name="Contributor",
* scope=example_azurerm_management_group["id"])
* example_get_role_management_policy = azure.pim.get_role_management_policy(scope=example.id,
* role_definition_id=mg_contributor.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = Azure.Management.GetGroup.Invoke(new()
* {
* Name = "example-group",
* });
* var mgContributor = Azure.Authorization.GetRoleDefinition.Invoke(new()
* {
* Name = "Contributor",
* Scope = exampleAzurermManagementGroup.Id,
* });
* var exampleGetRoleManagementPolicy = Azure.Pim.GetRoleManagementPolicy.Invoke(new()
* {
* Scope = example.Apply(getGroupResult => getGroupResult.Id),
* RoleDefinitionId = mgContributor.Apply(getRoleDefinitionResult => getRoleDefinitionResult.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/pim"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := management.LookupGroup(ctx, &management.LookupGroupArgs{
* Name: pulumi.StringRef("example-group"),
* }, nil)
* if err != nil {
* return err
* }
* mgContributor, err := authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
* Name: pulumi.StringRef("Contributor"),
* Scope: pulumi.StringRef(exampleAzurermManagementGroup.Id),
* }, nil)
* if err != nil {
* return err
* }
* _, err = pim.LookupRoleManagementPolicy(ctx, &pim.LookupRoleManagementPolicyArgs{
* Scope: example.Id,
* RoleDefinitionId: mgContributor.Id,
* }, 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.azure.management.ManagementFunctions;
* import com.pulumi.azure.management.inputs.GetGroupArgs;
* import com.pulumi.azure.authorization.AuthorizationFunctions;
* import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
* import com.pulumi.azure.pim.PimFunctions;
* import com.pulumi.azure.pim.inputs.GetRoleManagementPolicyArgs;
* 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 example = ManagementFunctions.getGroup(GetGroupArgs.builder()
* .name("example-group")
* .build());
* final var mgContributor = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
* .name("Contributor")
* .scope(exampleAzurermManagementGroup.id())
* .build());
* final var exampleGetRoleManagementPolicy = PimFunctions.getRoleManagementPolicy(GetRoleManagementPolicyArgs.builder()
* .scope(example.applyValue(getGroupResult -> getGroupResult.id()))
* .roleDefinitionId(mgContributor.applyValue(getRoleDefinitionResult -> getRoleDefinitionResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* variables:
* example:
* fn::invoke:
* Function: azure:management:getGroup
* Arguments:
* name: example-group
* mgContributor:
* fn::invoke:
* Function: azure:authorization:getRoleDefinition
* Arguments:
* name: Contributor
* scope: ${exampleAzurermManagementGroup.id}
* exampleGetRoleManagementPolicy:
* fn::invoke:
* Function: azure:pim:getRoleManagementPolicy
* Arguments:
* scope: ${example.id}
* roleDefinitionId: ${mgContributor.id}
* ```
*
* @param argument A collection of arguments for invoking getRoleManagementPolicy.
* @return A collection of values returned by getRoleManagementPolicy.
*/
public suspend fun getRoleManagementPolicy(argument: GetRoleManagementPolicyPlainArgs): GetRoleManagementPolicyResult =
toKotlin(getRoleManagementPolicyPlain(argument.toJava()).await())
/**
* @see [getRoleManagementPolicy].
* @param roleDefinitionId The scoped Role Definition ID of the role for which this policy applies.
* @param scope The scope to which this Role Management Policy applies. Can refer to a management group, a subscription or a resource group.
* @return A collection of values returned by getRoleManagementPolicy.
*/
public suspend fun getRoleManagementPolicy(roleDefinitionId: String, scope: String): GetRoleManagementPolicyResult {
val argument = GetRoleManagementPolicyPlainArgs(
roleDefinitionId = roleDefinitionId,
scope = scope,
)
return toKotlin(getRoleManagementPolicyPlain(argument.toJava()).await())
}
/**
* @see [getRoleManagementPolicy].
* @param argument Builder for [com.pulumi.azure.pim.kotlin.inputs.GetRoleManagementPolicyPlainArgs].
* @return A collection of values returned by getRoleManagementPolicy.
*/
public suspend fun getRoleManagementPolicy(argument: suspend GetRoleManagementPolicyPlainArgsBuilder.() -> Unit): GetRoleManagementPolicyResult {
val builder = GetRoleManagementPolicyPlainArgsBuilder()
builder.argument()
val builtArgument = builder.build()
return toKotlin(getRoleManagementPolicyPlain(builtArgument.toJava()).await())
}
}