Microsoft SQL Server v0.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse
mssql.getSchemas
Explore with Pulumi AI
Microsoft SQL Server v0.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse
Obtains information about all schemas found in SQL database.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as mssql from "@pulumi/mssql";
const example = mssql.getDatabase({
name: "example",
});
const all = example.then(example => mssql.getSchemas({
databaseId: example.id,
}));
export const allSchemaNames = all.then(all => all.schemas.map(__item => __item.name));
import pulumi
import pulumi_mssql as mssql
example = mssql.get_database(name="example")
all = mssql.get_schemas(database_id=example.id)
pulumi.export("allSchemaNames", [__item.name for __item in all.schemas])
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 {
example, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
Name: "example",
}, nil);
if err != nil {
return err
}
all, err := mssql.GetSchemas(ctx, &mssql.GetSchemasArgs{
DatabaseId: pulumi.StringRef(example.Id),
}, nil);
if err != nil {
return err
}
ctx.Export("allSchemaNames", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-functions-%smssql:index-getSchemas:getSchemas.pp:7,11-30)))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mssql = Pulumi.Mssql;
return await Deployment.RunAsync(() =>
{
var example = Mssql.GetDatabase.Invoke(new()
{
Name = "example",
});
var all = Mssql.GetSchemas.Invoke(new()
{
DatabaseId = example.Apply(getDatabaseResult => getDatabaseResult.Id),
});
return new Dictionary<string, object?>
{
["allSchemaNames"] = all.Apply(getSchemasResult => getSchemasResult.Schemas).Select(__item => __item.Name).ToList(),
};
});
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.GetSchemasArgs;
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 = MssqlFunctions.getDatabase(GetDatabaseArgs.builder()
.name("example")
.build());
final var all = MssqlFunctions.getSchemas(GetSchemasArgs.builder()
.databaseId(example.applyValue(getDatabaseResult -> getDatabaseResult.id()))
.build());
ctx.export("allSchemaNames", all.applyValue(getSchemasResult -> getSchemasResult.schemas()).stream().map(element -> element.name()).collect(toList()));
}
}
Coming soon!
Using getSchemas
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 getSchemas(args: GetSchemasArgs, opts?: InvokeOptions): Promise<GetSchemasResult>
function getSchemasOutput(args: GetSchemasOutputArgs, opts?: InvokeOptions): Output<GetSchemasResult>
def get_schemas(database_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSchemasResult
def get_schemas_output(database_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSchemasResult]
func GetSchemas(ctx *Context, args *GetSchemasArgs, opts ...InvokeOption) (*GetSchemasResult, error)
func GetSchemasOutput(ctx *Context, args *GetSchemasOutputArgs, opts ...InvokeOption) GetSchemasResultOutput
> Note: This function is named GetSchemas
in the Go SDK.
public static class GetSchemas
{
public static Task<GetSchemasResult> InvokeAsync(GetSchemasArgs args, InvokeOptions? opts = null)
public static Output<GetSchemasResult> Invoke(GetSchemasInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSchemasResult> getSchemas(GetSchemasArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: mssql:index/getSchemas:getSchemas
arguments:
# arguments dictionary
The following arguments are supported:
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- database_
id str - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
.
getSchemas Result
The following output properties are available:
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - Id string
- ID of the data source, equals to database ID
- Schemas
List<Pulumiverse.
Mssql. Outputs. Get Schemas Schema> - Set of schemas found in the DB.
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - Id string
- ID of the data source, equals to database ID
- Schemas
[]Get
Schemas Schema - Set of schemas found in the DB.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - id String
- ID of the data source, equals to database ID
- schemas
List<Get
Schemas Schema> - Set of schemas found in the DB.
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - id string
- ID of the data source, equals to database ID
- schemas
Get
Schemas Schema[] - Set of schemas found in the DB.
- database_
id str - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - id str
- ID of the data source, equals to database ID
- schemas
Sequence[Get
Schemas Schema] - Set of schemas found in the DB.
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. Defaults to ID ofmaster
. - id String
- ID of the data source, equals to database ID
- schemas List<Property Map>
- Set of schemas found in the DB.
Supporting Types
GetSchemasSchema
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - Id string
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- Name string
- Schema name.
- Owner
Id string - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
- Database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - Id string
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- Name string
- Schema name.
- Owner
Id string - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id String
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- name String
- Schema name.
- owner
Id String - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
- database
Id string - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id string
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- name string
- Schema name.
- owner
Id string - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
- database_
id str - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id str
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- name str
- Schema name.
- owner_
id str - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
- database
Id String - ID of database. Can be retrieved using
mssql.Database
orSELECT DB_ID('<db_name>')
. - id String
<database_id>/<schema_id>
. Schema ID can be retrieved usingSELECT SCHEMA_ID('<schema_name>')
.- name String
- Schema name.
- owner
Id String - ID of database role or user owning this schema. Can be retrieved using
mssql.DatabaseRole
,mssql.SqlUser
,mssql.AzureadUser
ormssql.AzureadServicePrincipal
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.1.0 published on Tuesday, Oct 8, 2024 by pulumiverse