com.pulumi.azure.datashare.kotlin.Share.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.datashare.kotlin
import com.pulumi.azure.datashare.kotlin.outputs.ShareSnapshotSchedule
import com.pulumi.azure.datashare.kotlin.outputs.ShareSnapshotSchedule.Companion.toKotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [Share].
*/
@PulumiTagMarker
public class ShareResourceBuilder internal constructor() {
public var name: String? = null
public var args: ShareArgs = ShareArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend ShareArgsBuilder.() -> Unit) {
val builder = ShareArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Share {
val builtJavaResource = com.pulumi.azure.datashare.Share(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Share(builtJavaResource)
}
}
/**
* Manages a Data Share.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleAccount = new azure.datashare.Account("example", {
* name: "example-dsa",
* location: example.location,
* resourceGroupName: example.name,
* identity: {
* type: "SystemAssigned",
* },
* tags: {
* foo: "bar",
* },
* });
* const exampleShare = new azure.datashare.Share("example", {
* name: "example_dss",
* accountId: exampleAccount.id,
* kind: "CopyBased",
* description: "example desc",
* terms: "example terms",
* snapshotSchedule: {
* name: "example-ss",
* recurrence: "Day",
* startTime: "2020-04-17T04:47:52.9614956Z",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_account = azure.datashare.Account("example",
* name="example-dsa",
* location=example.location,
* resource_group_name=example.name,
* identity=azure.datashare.AccountIdentityArgs(
* type="SystemAssigned",
* ),
* tags={
* "foo": "bar",
* })
* example_share = azure.datashare.Share("example",
* name="example_dss",
* account_id=example_account.id,
* kind="CopyBased",
* description="example desc",
* terms="example terms",
* snapshot_schedule=azure.datashare.ShareSnapshotScheduleArgs(
* name="example-ss",
* recurrence="Day",
* start_time="2020-04-17T04:47:52.9614956Z",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.DataShare.Account("example", new()
* {
* Name = "example-dsa",
* Location = example.Location,
* ResourceGroupName = example.Name,
* Identity = new Azure.DataShare.Inputs.AccountIdentityArgs
* {
* Type = "SystemAssigned",
* },
* Tags =
* {
* { "foo", "bar" },
* },
* });
* var exampleShare = new Azure.DataShare.Share("example", new()
* {
* Name = "example_dss",
* AccountId = exampleAccount.Id,
* Kind = "CopyBased",
* Description = "example desc",
* Terms = "example terms",
* SnapshotSchedule = new Azure.DataShare.Inputs.ShareSnapshotScheduleArgs
* {
* Name = "example-ss",
* Recurrence = "Day",
* StartTime = "2020-04-17T04:47:52.9614956Z",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/datashare"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := datashare.NewAccount(ctx, "example", &datashare.AccountArgs{
* Name: pulumi.String("example-dsa"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* Identity: &datashare.AccountIdentityArgs{
* Type: pulumi.String("SystemAssigned"),
* },
* Tags: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* })
* if err != nil {
* return err
* }
* _, err = datashare.NewShare(ctx, "example", &datashare.ShareArgs{
* Name: pulumi.String("example_dss"),
* AccountId: exampleAccount.ID(),
* Kind: pulumi.String("CopyBased"),
* Description: pulumi.String("example desc"),
* Terms: pulumi.String("example terms"),
* SnapshotSchedule: &datashare.ShareSnapshotScheduleArgs{
* Name: pulumi.String("example-ss"),
* Recurrence: pulumi.String("Day"),
* StartTime: pulumi.String("2020-04-17T04:47:52.9614956Z"),
* },
* })
* 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.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.datashare.Account;
* import com.pulumi.azure.datashare.AccountArgs;
* import com.pulumi.azure.datashare.inputs.AccountIdentityArgs;
* import com.pulumi.azure.datashare.Share;
* import com.pulumi.azure.datashare.ShareArgs;
* import com.pulumi.azure.datashare.inputs.ShareSnapshotScheduleArgs;
* 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) {
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("example-dsa")
* .location(example.location())
* .resourceGroupName(example.name())
* .identity(AccountIdentityArgs.builder()
* .type("SystemAssigned")
* .build())
* .tags(Map.of("foo", "bar"))
* .build());
* var exampleShare = new Share("exampleShare", ShareArgs.builder()
* .name("example_dss")
* .accountId(exampleAccount.id())
* .kind("CopyBased")
* .description("example desc")
* .terms("example terms")
* .snapshotSchedule(ShareSnapshotScheduleArgs.builder()
* .name("example-ss")
* .recurrence("Day")
* .startTime("2020-04-17T04:47:52.9614956Z")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleAccount:
* type: azure:datashare:Account
* name: example
* properties:
* name: example-dsa
* location: ${example.location}
* resourceGroupName: ${example.name}
* identity:
* type: SystemAssigned
* tags:
* foo: bar
* exampleShare:
* type: azure:datashare:Share
* name: example
* properties:
* name: example_dss
* accountId: ${exampleAccount.id}
* kind: CopyBased
* description: example desc
* terms: example terms
* snapshotSchedule:
* name: example-ss
* recurrence: Day
* startTime: 2020-04-17T04:47:52.9614956Z
* ```
*
* ## Import
* Data Shares can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:datashare/share:Share example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataShare/accounts/account1/shares/share1
* ```
*/
public class Share internal constructor(
override val javaResource: com.pulumi.azure.datashare.Share,
) : KotlinCustomResource(javaResource, ShareMapper) {
/**
* The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
*/
public val accountId: Output
get() = javaResource.accountId().applyValue({ args0 -> args0 })
/**
* The Data Share's description.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The kind of the Data Share. Possible values are `CopyBased` and `InPlace`. Changing this forces a new Data Share to be created.
*/
public val kind: Output
get() = javaResource.kind().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A `snapshot_schedule` block as defined below.
*/
public val snapshotSchedule: Output?
get() = javaResource.snapshotSchedule().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
}).orElse(null)
})
/**
* The terms of the Data Share.
*/
public val terms: Output?
get() = javaResource.terms().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object ShareMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.datashare.Share::class == javaResource::class
override fun map(javaResource: Resource): Share = Share(
javaResource as
com.pulumi.azure.datashare.Share,
)
}
/**
* @see [Share].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Share].
*/
public suspend fun share(name: String, block: suspend ShareResourceBuilder.() -> Unit): Share {
val builder = ShareResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Share].
* @param name The _unique_ name of the resulting resource.
*/
public fun share(name: String): Share {
val builder = ShareResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy