databricks.getViews
Explore with Pulumi AI
Related Resources
The following resources are used in the same context:
- databricks.Schema to manage schemas within Unity Catalog.
- databricks.Catalog to manage catalogs within Unity Catalog.
Example Usage
Granting
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(async() =>
{
var thingsViews = await Databricks.GetViews.InvokeAsync(new()
{
CatalogName = "sandbox",
SchemaName = "things",
});
var thingsGrants = new List<Databricks.Grants>();
foreach (var range in )
{
thingsGrants.Add(new Databricks.Grants($"thingsGrants-{range.Key}", new()
{
View = range.Value,
GrantDetails = new[]
{
new Databricks.Inputs.GrantsGrantArgs
{
Principal = "sensitive",
Privileges = new[]
{
"SELECT",
"MODIFY",
},
},
},
}));
}
});
package main
import (
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
thingsViews, err := databricks.GetViews(ctx, &databricks.GetViewsArgs{
CatalogName: "sandbox",
SchemaName: "things",
}, nil)
if err != nil {
return err
}
var thingsGrants []*databricks.Grants
for key0, val0 := range thingsViews.Ids {
__res, err := databricks.NewGrants(ctx, fmt.Sprintf("thingsGrants-%v", key0), &databricks.GrantsArgs{
View: pulumi.String(val0),
Grants: databricks.GrantsGrantArray{
&databricks.GrantsGrantArgs{
Principal: pulumi.String("sensitive"),
Privileges: pulumi.StringArray{
pulumi.String("SELECT"),
pulumi.String("MODIFY"),
},
},
},
})
if err != nil {
return err
}
thingsGrants = append(thingsGrants, __res)
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.DatabricksFunctions;
import com.pulumi.databricks.inputs.GetViewsArgs;
import com.pulumi.databricks.Grants;
import com.pulumi.databricks.GrantsArgs;
import com.pulumi.databricks.inputs.GrantsGrantArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 thingsViews = DatabricksFunctions.getViews(GetViewsArgs.builder()
.catalogName("sandbox")
.schemaName("things")
.build());
final var thingsGrants = thingsViews.applyValue(getViewsResult -> {
final var resources = new ArrayList<Grants>();
for (var range : KeyedValue.of(getViewsResult.ids()) {
var resource = new Grants("thingsGrants-" + range.key(), GrantsArgs.builder()
.view(range.value())
.grants(GrantsGrantArgs.builder()
.principal("sensitive")
.privileges(
"SELECT",
"MODIFY")
.build())
.build());
resources.add(resource);
}
return resources;
});
}
}
import pulumi
import pulumi_databricks as databricks
things_views = databricks.get_views(catalog_name="sandbox",
schema_name="things")
things_grants = []
for range in [{"key": k, "value": v} for [k, v] in enumerate(things_views.ids)]:
things_grants.append(databricks.Grants(f"thingsGrants-{range['key']}",
view=range["value"],
grants=[databricks.GrantsGrantArgs(
principal="sensitive",
privileges=[
"SELECT",
"MODIFY",
],
)]))
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
export = async () => {
const thingsViews = await databricks.getViews({
catalogName: "sandbox",
schemaName: "things",
});
const thingsGrants: databricks.Grants[] = [];
for (const range of thingsViews.ids.map((v, k) => ({key: k, value: v}))) {
thingsGrants.push(new databricks.Grants(`thingsGrants-${range.key}`, {
view: range.value,
grants: [{
principal: "sensitive",
privileges: [
"SELECT",
"MODIFY",
],
}],
}));
}
}
resources:
thingsGrants:
type: databricks:Grants
properties:
view: ${range.value}
grants:
- principal: sensitive
privileges:
- SELECT
- MODIFY
options: {}
variables:
thingsViews:
fn::invoke:
Function: databricks:getViews
Arguments:
catalogName: sandbox
schemaName: things
Using getViews
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 getViews(args: GetViewsArgs, opts?: InvokeOptions): Promise<GetViewsResult>
function getViewsOutput(args: GetViewsOutputArgs, opts?: InvokeOptions): Output<GetViewsResult>
def get_views(catalog_name: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
schema_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetViewsResult
def get_views_output(catalog_name: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
schema_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetViewsResult]
func GetViews(ctx *Context, args *GetViewsArgs, opts ...InvokeOption) (*GetViewsResult, error)
func GetViewsOutput(ctx *Context, args *GetViewsOutputArgs, opts ...InvokeOption) GetViewsResultOutput
> Note: This function is named GetViews
in the Go SDK.
public static class GetViews
{
public static Task<GetViewsResult> InvokeAsync(GetViewsArgs args, InvokeOptions? opts = null)
public static Output<GetViewsResult> Invoke(GetViewsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetViewsResult> getViews(GetViewsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: databricks:index/getViews:getViews
arguments:
# arguments dictionary
The following arguments are supported:
- Catalog
Name string Name of databricks_catalog
- Schema
Name string Name of databricks_schema
- Ids List<string>
set of databricks_view full names:
catalog
.schema
.view
- Catalog
Name string Name of databricks_catalog
- Schema
Name string Name of databricks_schema
- Ids []string
set of databricks_view full names:
catalog
.schema
.view
- catalog
Name String Name of databricks_catalog
- schema
Name String Name of databricks_schema
- ids List<String>
set of databricks_view full names:
catalog
.schema
.view
- catalog
Name string Name of databricks_catalog
- schema
Name string Name of databricks_schema
- ids string[]
set of databricks_view full names:
catalog
.schema
.view
- catalog_
name str Name of databricks_catalog
- schema_
name str Name of databricks_schema
- ids Sequence[str]
set of databricks_view full names:
catalog
.schema
.view
- catalog
Name String Name of databricks_catalog
- schema
Name String Name of databricks_schema
- ids List<String>
set of databricks_view full names:
catalog
.schema
.view
getViews Result
The following output properties are available:
- Catalog
Name string - Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
set of databricks_view full names:
catalog
.schema
.view
- Schema
Name string
- Catalog
Name string - Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
set of databricks_view full names:
catalog
.schema
.view
- Schema
Name string
- catalog
Name String - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
set of databricks_view full names:
catalog
.schema
.view
- schema
Name String
- catalog
Name string - id string
The provider-assigned unique ID for this managed resource.
- ids string[]
set of databricks_view full names:
catalog
.schema
.view
- schema
Name string
- catalog_
name str - id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
set of databricks_view full names:
catalog
.schema
.view
- schema_
name str
- catalog
Name String - id String
The provider-assigned unique ID for this managed resource.
- ids List<String>
set of databricks_view full names:
catalog
.schema
.view
- schema
Name String
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
databricks
Terraform Provider.