1. Packages
  2. MSSQL
  3. API Docs
  4. getServerRole
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

mssql.getServerRole

Explore with Pulumi AI

mssql logo
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

    Obtains information about single server role.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumi.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var byName = Mssql.GetServerRole.Invoke(new()
        {
            Name = "example",
        });
    
        var byId = Mssql.GetServerRole.Invoke(new()
        {
            Id = "8",
        });
    
    });
    
    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 {
    		_, err := mssql.LookupServerRole(ctx, &mssql.LookupServerRoleArgs{
    			Name: pulumi.StringRef("example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = mssql.LookupServerRole(ctx, &mssql.LookupServerRoleArgs{
    			Id: pulumi.StringRef("8"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		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.GetServerRoleArgs;
    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 byName = MssqlFunctions.getServerRole(GetServerRoleArgs.builder()
                .name("example")
                .build());
    
            final var byId = MssqlFunctions.getServerRole(GetServerRoleArgs.builder()
                .id(8)
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_mssql as mssql
    
    by_name = mssql.get_server_role(name="example")
    by_id = mssql.get_server_role(id="8")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumi/mssql";
    
    const byName = mssql.getServerRole({
        name: "example",
    });
    const byId = mssql.getServerRole({
        id: "8",
    });
    
    variables:
      byName:
        fn::invoke:
          Function: mssql:getServerRole
          Arguments:
            name: example
      byId:
        fn::invoke:
          Function: mssql:getServerRole
          Arguments:
            id: 8
    

    Using getServerRole

    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 getServerRole(args: GetServerRoleArgs, opts?: InvokeOptions): Promise<GetServerRoleResult>
    function getServerRoleOutput(args: GetServerRoleOutputArgs, opts?: InvokeOptions): Output<GetServerRoleResult>
    def get_server_role(id: Optional[str] = None,
                        name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetServerRoleResult
    def get_server_role_output(id: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetServerRoleResult]
    func LookupServerRole(ctx *Context, args *LookupServerRoleArgs, opts ...InvokeOption) (*LookupServerRoleResult, error)
    func LookupServerRoleOutput(ctx *Context, args *LookupServerRoleOutputArgs, opts ...InvokeOption) LookupServerRoleResultOutput

    > Note: This function is named LookupServerRole in the Go SDK.

    public static class GetServerRole 
    {
        public static Task<GetServerRoleResult> InvokeAsync(GetServerRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetServerRoleResult> Invoke(GetServerRoleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServerRoleResult> getServerRole(GetServerRoleArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: mssql:index/getServerRole:getServerRole
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    ID of the member principal
    Name string
    Name of the server principal
    Id string
    ID of the member principal
    Name string
    Name of the server principal
    id String
    ID of the member principal
    name String
    Name of the server principal
    id string
    ID of the member principal
    name string
    Name of the server principal
    id str
    ID of the member principal
    name str
    Name of the server principal
    id String
    ID of the member principal
    name String
    Name of the server principal

    getServerRole Result

    The following output properties are available:

    Id string
    Role principal ID. Either name or id must be provided.
    Members List<Pulumiverse.Mssql.Outputs.GetServerRoleMember>
    Set of role members
    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    Id string
    Role principal ID. Either name or id must be provided.
    Members []GetServerRoleMemberType
    Set of role members
    Name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    OwnerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    id String
    Role principal ID. Either name or id must be provided.
    members List<GetServerRoleMember>
    Set of role members
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    id string
    Role principal ID. Either name or id must be provided.
    members GetServerRoleMember[]
    Set of role members
    name string
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    ownerId string
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    id str
    Role principal ID. Either name or id must be provided.
    members Sequence[GetServerRoleMember]
    Set of role members
    name str
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    owner_id str
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.
    id String
    Role principal ID. Either name or id must be provided.
    members List<Property Map>
    Set of role members
    name String
    Role name. Must follow Regular Identifiers rules and cannot be longer than 128 chars. Either name or id must be provided.
    ownerId String
    ID of another server role or login owning this role. Can be retrieved using mssql.ServerRole or mssql.SqlLogin.

    Supporting Types

    GetServerRoleMember

    Id string
    ID of the member principal
    Name string
    Name of the server principal
    Type string
    One of: SQL_LOGIN, SERVER_ROLE
    Id string
    ID of the member principal
    Name string
    Name of the server principal
    Type string
    One of: SQL_LOGIN, SERVER_ROLE
    id String
    ID of the member principal
    name String
    Name of the server principal
    type String
    One of: SQL_LOGIN, SERVER_ROLE
    id string
    ID of the member principal
    name string
    Name of the server principal
    type string
    One of: SQL_LOGIN, SERVER_ROLE
    id str
    ID of the member principal
    name str
    Name of the server principal
    type str
    One of: SQL_LOGIN, SERVER_ROLE
    id String
    ID of the member principal
    name String
    Name of the server principal
    type String
    One of: SQL_LOGIN, SERVER_ROLE

    Package Details

    Repository
    mssql pulumiverse/pulumi-mssql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mssql Terraform Provider.
    mssql logo
    Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse