Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse
mssql.getSchemaPermissions
Explore with Pulumi AI
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse
Returns all permissions granted in a schema to given principal
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mssql = Pulumi.Mssql;
return await Deployment.RunAsync(() =>
{
var exampleDatabase = Mssql.GetDatabase.Invoke(new()
{
Name = "example",
});
var exampleSqlUser = Mssql.GetSqlUser.Invoke(new()
{
Name = "example_user",
DatabaseId = exampleDatabase.Apply(getDatabaseResult => getDatabaseResult.Id),
});
var exampleSchema = Mssql.GetSchema.Invoke(new()
{
Name = "example_schema",
DatabaseId = exampleDatabase.Apply(getDatabaseResult => getDatabaseResult.Id),
});
var exampleSchemaPermissions = Mssql.GetSchemaPermissions.Invoke(new()
{
SchemaId = exampleSchema.Apply(getSchemaResult => getSchemaResult.Id),
PrincipalId = exampleSqlUser.Apply(getSqlUserResult => getSqlUserResult.Id),
});
return new Dictionary<string, object?>
{
["permissions"] = exampleSchemaPermissions.Apply(getSchemaPermissionsResult => getSchemaPermissionsResult.Permissions),
};
});
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-mssql/sdk/go/mssql"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleDatabase, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
Name: "example",
}, nil)
if err != nil {
return err
}
exampleSqlUser, err := mssql.LookupSqlUser(ctx, &mssql.LookupSqlUserArgs{
Name: "example_user",
DatabaseId: pulumi.StringRef(exampleDatabase.Id),
}, nil)
if err != nil {
return err
}
exampleSchema, err := mssql.LookupSchema(ctx, &mssql.LookupSchemaArgs{
Name: pulumi.StringRef("example_schema"),
DatabaseId: pulumi.StringRef(exampleDatabase.Id),
}, nil)
if err != nil {
return err
}
exampleSchemaPermissions, err := mssql.GetSchemaPermissions(ctx, &mssql.GetSchemaPermissionsArgs{
SchemaId: exampleSchema.Id,
PrincipalId: exampleSqlUser.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("permissions", exampleSchemaPermissions.Permissions)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mssql.MssqlFunctions;
import com.pulumi.mssql.inputs.GetDatabaseArgs;
import com.pulumi.mssql.inputs.GetSqlUserArgs;
import com.pulumi.mssql.inputs.GetSchemaArgs;
import com.pulumi.mssql.inputs.GetSchemaPermissionsArgs;
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 exampleDatabase = MssqlFunctions.getDatabase(GetDatabaseArgs.builder()
.name("example")
.build());
final var exampleSqlUser = MssqlFunctions.getSqlUser(GetSqlUserArgs.builder()
.name("example_user")
.databaseId(exampleDatabase.applyValue(getDatabaseResult -> getDatabaseResult.id()))
.build());
final var exampleSchema = MssqlFunctions.getSchema(GetSchemaArgs.builder()
.name("example_schema")
.databaseId(exampleDatabase.applyValue(getDatabaseResult -> getDatabaseResult.id()))
.build());
final var exampleSchemaPermissions = MssqlFunctions.getSchemaPermissions(GetSchemaPermissionsArgs.builder()
.schemaId(exampleSchema.applyValue(getSchemaResult -> getSchemaResult.id()))
.principalId(exampleSqlUser.applyValue(getSqlUserResult -> getSqlUserResult.id()))
.build());
ctx.export("permissions", exampleSchemaPermissions.applyValue(getSchemaPermissionsResult -> getSchemaPermissionsResult.permissions()));
}
}
import pulumi
import pulumi_mssql as mssql
example_database = mssql.get_database(name="example")
example_sql_user = mssql.get_sql_user(name="example_user",
database_id=example_database.id)
example_schema = mssql.get_schema(name="example_schema",
database_id=example_database.id)
example_schema_permissions = mssql.get_schema_permissions(schema_id=example_schema.id,
principal_id=example_sql_user.id)
pulumi.export("permissions", example_schema_permissions.permissions)
import * as pulumi from "@pulumi/pulumi";
import * as mssql from "@pulumi/mssql";
const exampleDatabase = mssql.getDatabase({
name: "example",
});
const exampleSqlUser = exampleDatabase.then(exampleDatabase => mssql.getSqlUser({
name: "example_user",
databaseId: exampleDatabase.id,
}));
const exampleSchema = exampleDatabase.then(exampleDatabase => mssql.getSchema({
name: "example_schema",
databaseId: exampleDatabase.id,
}));
const exampleSchemaPermissions = Promise.all([exampleSchema, exampleSqlUser]).then(([exampleSchema, exampleSqlUser]) => mssql.getSchemaPermissions({
schemaId: exampleSchema.id,
principalId: exampleSqlUser.id,
}));
export const permissions = exampleSchemaPermissions.then(exampleSchemaPermissions => exampleSchemaPermissions.permissions);
variables:
exampleDatabase:
fn::invoke:
Function: mssql:getDatabase
Arguments:
name: example
exampleSqlUser:
fn::invoke:
Function: mssql:getSqlUser
Arguments:
name: example_user
databaseId: ${exampleDatabase.id}
exampleSchema:
fn::invoke:
Function: mssql:getSchema
Arguments:
name: example_schema
databaseId: ${exampleDatabase.id}
exampleSchemaPermissions:
fn::invoke:
Function: mssql:getSchemaPermissions
Arguments:
schemaId: ${exampleSchema.id}
principalId: ${exampleSqlUser.id}
outputs:
permissions: ${exampleSchemaPermissions.permissions}
Using getSchemaPermissions
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSchemaPermissions(args: GetSchemaPermissionsArgs, opts?: InvokeOptions): Promise<GetSchemaPermissionsResult>
function getSchemaPermissionsOutput(args: GetSchemaPermissionsOutputArgs, opts?: InvokeOptions): Output<GetSchemaPermissionsResult>
def get_schema_permissions(principal_id: Optional[str] = None,
schema_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSchemaPermissionsResult
def get_schema_permissions_output(principal_id: Optional[pulumi.Input[str]] = None,
schema_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSchemaPermissionsResult]
func GetSchemaPermissions(ctx *Context, args *GetSchemaPermissionsArgs, opts ...InvokeOption) (*GetSchemaPermissionsResult, error)
func GetSchemaPermissionsOutput(ctx *Context, args *GetSchemaPermissionsOutputArgs, opts ...InvokeOption) GetSchemaPermissionsResultOutput
> Note: This function is named GetSchemaPermissions
in the Go SDK.
public static class GetSchemaPermissions
{
public static Task<GetSchemaPermissionsResult> InvokeAsync(GetSchemaPermissionsArgs args, InvokeOptions? opts = null)
public static Output<GetSchemaPermissionsResult> Invoke(GetSchemaPermissionsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSchemaPermissionsResult> getSchemaPermissions(GetSchemaPermissionsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: mssql:index/getSchemaPermissions:getSchemaPermissions
arguments:
# arguments dictionary
The following arguments are supported:
- Principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- Schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- Principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- Schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- principal
Id String <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id String <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- principal_
id str <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema_
id str <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- principal
Id String <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id String <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
getSchemaPermissions Result
The following output properties are available:
- Id string
<database_id>/<schema_id>/<principal_id>
.- Permissions
List<Pulumiverse.
Mssql. Outputs. Get Schema Permissions Permission> - Set of permissions granted to the principal
- Principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- Schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- Id string
<database_id>/<schema_id>/<principal_id>
.- Permissions
[]Get
Schema Permissions Permission - Set of permissions granted to the principal
- Principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- Schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- id String
<database_id>/<schema_id>/<principal_id>
.- permissions
List<Get
Schema Permissions Permission> - Set of permissions granted to the principal
- principal
Id String <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id String <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- id string
<database_id>/<schema_id>/<principal_id>
.- permissions
Get
Schema Permissions Permission[] - Set of permissions granted to the principal
- principal
Id string <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id string <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- id str
<database_id>/<schema_id>/<principal_id>
.- permissions
Sequence[Get
Schema Permissions Permission] - Set of permissions granted to the principal
- principal_
id str <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema_
id str <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
- id String
<database_id>/<schema_id>/<principal_id>
.- permissions List<Property Map>
- Set of permissions granted to the principal
- principal
Id String <database_id>/<principal_id>
. Can be retrieved usingmssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
.- schema
Id String <database_id>/<schema_id>
. Can be retrieved usingmssql.Schema
.
Supporting Types
GetSchemaPermissionsPermission
- Permission string
- Name of schema SQL permission. For full list of supported permissions, see docs
- With
Grant boolOption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
- Permission string
- Name of schema SQL permission. For full list of supported permissions, see docs
- With
Grant boolOption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
- permission String
- Name of schema SQL permission. For full list of supported permissions, see docs
- with
Grant BooleanOption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
- permission string
- Name of schema SQL permission. For full list of supported permissions, see docs
- with
Grant booleanOption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
- permission str
- Name of schema SQL permission. For full list of supported permissions, see docs
- with_
grant_ booloption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
- permission String
- Name of schema SQL permission. For full list of supported permissions, see docs
- with
Grant BooleanOption - When set to
true
,principal_id
will be allowed to grant thepermission
to other principals.
Package Details
- Repository
- mssql pulumiverse/pulumi-mssql
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mssql
Terraform Provider.
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse