All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.mssql.kotlin.JobAgent.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.21.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.mssql.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
import kotlin.collections.Map

/**
 * Builder for [JobAgent].
 */
@PulumiTagMarker
public class JobAgentResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: JobAgentArgs = JobAgentArgs()

    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 JobAgentArgsBuilder.() -> Unit) {
        val builder = JobAgentArgsBuilder()
        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(): JobAgent {
        val builtJavaResource = com.pulumi.azure.mssql.JobAgent(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return JobAgent(builtJavaResource)
    }
}

/**
 * Manages an Elastic Job Agent.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "northeurope",
 * });
 * const exampleServer = new azure.mssql.Server("example", {
 *     name: "example-server",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "4dm1n157r470r",
 *     administratorLoginPassword: "4-v3ry-53cr37-p455w0rd",
 * });
 * const exampleDatabase = new azure.mssql.Database("example", {
 *     name: "example-db",
 *     serverId: exampleServer.id,
 *     collation: "SQL_Latin1_General_CP1_CI_AS",
 *     skuName: "S1",
 * });
 * const exampleJobAgent = new azure.mssql.JobAgent("example", {
 *     name: "example-job-agent",
 *     location: example.location,
 *     databaseId: exampleDatabase.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example",
 *     location="northeurope")
 * example_server = azure.mssql.Server("example",
 *     name="example-server",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     version="12.0",
 *     administrator_login="4dm1n157r470r",
 *     administrator_login_password="4-v3ry-53cr37-p455w0rd")
 * example_database = azure.mssql.Database("example",
 *     name="example-db",
 *     server_id=example_server.id,
 *     collation="SQL_Latin1_General_CP1_CI_AS",
 *     sku_name="S1")
 * example_job_agent = azure.mssql.JobAgent("example",
 *     name="example-job-agent",
 *     location=example.location,
 *     database_id=example_database.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 = "example",
 *         Location = "northeurope",
 *     });
 *     var exampleServer = new Azure.MSSql.Server("example", new()
 *     {
 *         Name = "example-server",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Version = "12.0",
 *         AdministratorLogin = "4dm1n157r470r",
 *         AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
 *     });
 *     var exampleDatabase = new Azure.MSSql.Database("example", new()
 *     {
 *         Name = "example-db",
 *         ServerId = exampleServer.Id,
 *         Collation = "SQL_Latin1_General_CP1_CI_AS",
 *         SkuName = "S1",
 *     });
 *     var exampleJobAgent = new Azure.MSSql.JobAgent("example", new()
 *     {
 *         Name = "example-job-agent",
 *         Location = example.Location,
 *         DatabaseId = exampleDatabase.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
 * 	"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"),
 * 			Location: pulumi.String("northeurope"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
 * 			Name:                       pulumi.String("example-server"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			Version:                    pulumi.String("12.0"),
 * 			AdministratorLogin:         pulumi.String("4dm1n157r470r"),
 * 			AdministratorLoginPassword: pulumi.String("4-v3ry-53cr37-p455w0rd"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleDatabase, err := mssql.NewDatabase(ctx, "example", &mssql.DatabaseArgs{
 * 			Name:      pulumi.String("example-db"),
 * 			ServerId:  exampleServer.ID(),
 * 			Collation: pulumi.String("SQL_Latin1_General_CP1_CI_AS"),
 * 			SkuName:   pulumi.String("S1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mssql.NewJobAgent(ctx, "example", &mssql.JobAgentArgs{
 * 			Name:       pulumi.String("example-job-agent"),
 * 			Location:   example.Location,
 * 			DatabaseId: exampleDatabase.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.mssql.Server;
 * import com.pulumi.azure.mssql.ServerArgs;
 * import com.pulumi.azure.mssql.Database;
 * import com.pulumi.azure.mssql.DatabaseArgs;
 * import com.pulumi.azure.mssql.JobAgent;
 * import com.pulumi.azure.mssql.JobAgentArgs;
 * 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")
 *             .location("northeurope")
 *             .build());
 *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
 *             .name("example-server")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .version("12.0")
 *             .administratorLogin("4dm1n157r470r")
 *             .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
 *             .build());
 *         var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
 *             .name("example-db")
 *             .serverId(exampleServer.id())
 *             .collation("SQL_Latin1_General_CP1_CI_AS")
 *             .skuName("S1")
 *             .build());
 *         var exampleJobAgent = new JobAgent("exampleJobAgent", JobAgentArgs.builder()
 *             .name("example-job-agent")
 *             .location(example.location())
 *             .databaseId(exampleDatabase.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example
 *       location: northeurope
 *   exampleServer:
 *     type: azure:mssql:Server
 *     name: example
 *     properties:
 *       name: example-server
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       version: '12.0'
 *       administratorLogin: 4dm1n157r470r
 *       administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
 *   exampleDatabase:
 *     type: azure:mssql:Database
 *     name: example
 *     properties:
 *       name: example-db
 *       serverId: ${exampleServer.id}
 *       collation: SQL_Latin1_General_CP1_CI_AS
 *       skuName: S1
 *   exampleJobAgent:
 *     type: azure:mssql:JobAgent
 *     name: example
 *     properties:
 *       name: example-job-agent
 *       location: ${example.location}
 *       databaseId: ${exampleDatabase.id}
 * ```
 * 
 * ## Import
 * Elastic Job Agents can be imported using the `id`, e.g.
 * ```sh
 * $ pulumi import azure:mssql/jobAgent:JobAgent example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Sql/servers/myserver1/jobAgents/myjobagent1
 * ```
 */
public class JobAgent internal constructor(
    override val javaResource: com.pulumi.azure.mssql.JobAgent,
) : KotlinCustomResource(javaResource, JobAgentMapper) {
    /**
     * The ID of the database to store metadata for the Elastic Job Agent. Changing this forces a new Elastic Job Agent to be created.
     */
    public val databaseId: Output
        get() = javaResource.databaseId().applyValue({ args0 -> args0 })

    /**
     * The Azure Region where the Elastic Job Agent should exist. Changing this forces a new Elastic Job Agent to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Elastic Job Agent. Changing this forces a new Elastic Job Agent to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the Database.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object JobAgentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mssql.JobAgent::class == javaResource::class

    override fun map(javaResource: Resource): JobAgent = JobAgent(
        javaResource as
            com.pulumi.azure.mssql.JobAgent,
    )
}

/**
 * @see [JobAgent].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [JobAgent].
 */
public suspend fun jobAgent(name: String, block: suspend JobAgentResourceBuilder.() -> Unit): JobAgent {
    val builder = JobAgentResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [JobAgent].
 * @param name The _unique_ name of the resulting resource.
 */
public fun jobAgent(name: String): JobAgent {
    val builder = JobAgentResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy