com.pulumi.azure.loganalytics.kotlin.LinkedService.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.loganalytics.kotlin
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 [LinkedService].
*/
@PulumiTagMarker
public class LinkedServiceResourceBuilder internal constructor() {
public var name: String? = null
public var args: LinkedServiceArgs = LinkedServiceArgs()
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 LinkedServiceArgsBuilder.() -> Unit) {
val builder = LinkedServiceArgsBuilder()
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(): LinkedService {
val builtJavaResource = com.pulumi.azure.loganalytics.LinkedService(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return LinkedService(builtJavaResource)
}
}
/**
* Manages a Log Analytics Linked Service.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "resourcegroup-01",
* location: "West Europe",
* });
* const exampleAccount = new azure.automation.Account("example", {
* name: "automation-01",
* location: example.location,
* resourceGroupName: example.name,
* skuName: "Basic",
* tags: {
* environment: "development",
* },
* });
* const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
* name: "workspace-01",
* location: example.location,
* resourceGroupName: example.name,
* sku: "PerGB2018",
* retentionInDays: 30,
* });
* const exampleLinkedService = new azure.loganalytics.LinkedService("example", {
* resourceGroupName: example.name,
* workspaceId: exampleAnalyticsWorkspace.id,
* readAccessId: exampleAccount.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="resourcegroup-01",
* location="West Europe")
* example_account = azure.automation.Account("example",
* name="automation-01",
* location=example.location,
* resource_group_name=example.name,
* sku_name="Basic",
* tags={
* "environment": "development",
* })
* example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
* name="workspace-01",
* location=example.location,
* resource_group_name=example.name,
* sku="PerGB2018",
* retention_in_days=30)
* example_linked_service = azure.loganalytics.LinkedService("example",
* resource_group_name=example.name,
* workspace_id=example_analytics_workspace.id,
* read_access_id=example_account.id)
* ```
* ```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 = "resourcegroup-01",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Automation.Account("example", new()
* {
* Name = "automation-01",
* Location = example.Location,
* ResourceGroupName = example.Name,
* SkuName = "Basic",
* Tags =
* {
* { "environment", "development" },
* },
* });
* var exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
* {
* Name = "workspace-01",
* Location = example.Location,
* ResourceGroupName = example.Name,
* Sku = "PerGB2018",
* RetentionInDays = 30,
* });
* var exampleLinkedService = new Azure.LogAnalytics.LinkedService("example", new()
* {
* ResourceGroupName = example.Name,
* WorkspaceId = exampleAnalyticsWorkspace.Id,
* ReadAccessId = exampleAccount.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/automation"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/loganalytics"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
* "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("resourcegroup-01"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
* Name: pulumi.String("automation-01"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* SkuName: pulumi.String("Basic"),
* Tags: pulumi.StringMap{
* "environment": pulumi.String("development"),
* },
* })
* if err != nil {
* return err
* }
* exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
* Name: pulumi.String("workspace-01"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* Sku: pulumi.String("PerGB2018"),
* RetentionInDays: pulumi.Int(30),
* })
* if err != nil {
* return err
* }
* _, err = loganalytics.NewLinkedService(ctx, "example", &loganalytics.LinkedServiceArgs{
* ResourceGroupName: example.Name,
* WorkspaceId: exampleAnalyticsWorkspace.ID(),
* ReadAccessId: exampleAccount.ID(),
* })
* 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.automation.Account;
* import com.pulumi.azure.automation.AccountArgs;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
* import com.pulumi.azure.loganalytics.LinkedService;
* import com.pulumi.azure.loganalytics.LinkedServiceArgs;
* 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("resourcegroup-01")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("automation-01")
* .location(example.location())
* .resourceGroupName(example.name())
* .skuName("Basic")
* .tags(Map.of("environment", "development"))
* .build());
* var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
* .name("workspace-01")
* .location(example.location())
* .resourceGroupName(example.name())
* .sku("PerGB2018")
* .retentionInDays(30)
* .build());
* var exampleLinkedService = new LinkedService("exampleLinkedService", LinkedServiceArgs.builder()
* .resourceGroupName(example.name())
* .workspaceId(exampleAnalyticsWorkspace.id())
* .readAccessId(exampleAccount.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: resourcegroup-01
* location: West Europe
* exampleAccount:
* type: azure:automation:Account
* name: example
* properties:
* name: automation-01
* location: ${example.location}
* resourceGroupName: ${example.name}
* skuName: Basic
* tags:
* environment: development
* exampleAnalyticsWorkspace:
* type: azure:operationalinsights:AnalyticsWorkspace
* name: example
* properties:
* name: workspace-01
* location: ${example.location}
* resourceGroupName: ${example.name}
* sku: PerGB2018
* retentionInDays: 30
* exampleLinkedService:
* type: azure:loganalytics:LinkedService
* name: example
* properties:
* resourceGroupName: ${example.name}
* workspaceId: ${exampleAnalyticsWorkspace.id}
* readAccessId: ${exampleAccount.id}
* ```
*
* ## Import
* Log Analytics Workspaces can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:loganalytics/linkedService:LinkedService example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/linkedServices/Automation
* ```
*/
public class LinkedService internal constructor(
override val javaResource: com.pulumi.azure.loganalytics.LinkedService,
) : KotlinCustomResource(javaResource, LinkedServiceMapper) {
/**
* The generated name of the Linked Service. The format for this attribute is always `/`(e.g. `workspace1/Automation` or `workspace1/Cluster`)
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.
*/
public val readAccessId: Output
get() = javaResource.readAccessId().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
*/
public val workspaceId: Output
get() = javaResource.workspaceId().applyValue({ args0 -> args0 })
/**
* The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.
* > **NOTE:** You must define at least one of the above access resource id attributes (e.g. `read_access_id` or `write_access_id`).
*/
public val writeAccessId: Output?
get() = javaResource.writeAccessId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
}
public object LinkedServiceMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.loganalytics.LinkedService::class == javaResource::class
override fun map(javaResource: Resource): LinkedService = LinkedService(
javaResource as
com.pulumi.azure.loganalytics.LinkedService,
)
}
/**
* @see [LinkedService].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [LinkedService].
*/
public suspend fun linkedService(
name: String,
block: suspend LinkedServiceResourceBuilder.() -> Unit,
): LinkedService {
val builder = LinkedServiceResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [LinkedService].
* @param name The _unique_ name of the resulting resource.
*/
public fun linkedService(name: String): LinkedService {
val builder = LinkedServiceResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy