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

com.pulumi.cloudflare.kotlin.ZeroTrustAccessIdentityProvider.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustAccessIdentityProviderConfig
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustAccessIdentityProviderScimConfig
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.List
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustAccessIdentityProviderConfig.Companion.toKotlin as zeroTrustAccessIdentityProviderConfigToKotlin
import com.pulumi.cloudflare.kotlin.outputs.ZeroTrustAccessIdentityProviderScimConfig.Companion.toKotlin as zeroTrustAccessIdentityProviderScimConfigToKotlin

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

    public var args: ZeroTrustAccessIdentityProviderArgs = ZeroTrustAccessIdentityProviderArgs()

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

/**
 * Provides a Cloudflare Access Identity Provider resource. Identity
 * Providers are used as an authentication or authorisation source
 * within Access.
 * > It's required that an `account_id` or `zone_id` is provided and in
 *    most cases using either is fine. However, if you're using a scoped
 *    access token, you must provide the argument that matches the token's
 *    scope. For example, an access token that is scoped to the "example.com"
 *    zone needs to use the `zone_id` argument.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // one time pin
 * const pinLogin = new cloudflare.ZeroTrustAccessIdentityProvider("pin_login", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "PIN login",
 *     type: "onetimepin",
 * });
 * // oauth
 * const githubOauth = new cloudflare.ZeroTrustAccessIdentityProvider("github_oauth", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "GitHub OAuth",
 *     type: "github",
 *     configs: [{
 *         clientId: "example",
 *         clientSecret: "secret_key",
 *     }],
 * });
 * // saml
 * const jumpcloudSaml = new cloudflare.ZeroTrustAccessIdentityProvider("jumpcloud_saml", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "JumpCloud SAML",
 *     type: "saml",
 *     configs: [{
 *         issuerUrl: "jumpcloud",
 *         ssoTargetUrl: "https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess",
 *         attributes: [
 *             "email",
 *             "username",
 *         ],
 *         signRequest: false,
 *         idpPublicCert: `MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg
 * uTnQyuOqPuHbnN83d/2l1NSYKCbHt24o`,
 *     }],
 * });
 * // okta
 * const okta = new cloudflare.ZeroTrustAccessIdentityProvider("okta", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "Okta",
 *     type: "okta",
 *     configs: [{
 *         clientId: "example",
 *         clientSecret: "secret_key",
 *         apiToken: "okta_api_token",
 *         oktaAccount: "https://example.com",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # one time pin
 * pin_login = cloudflare.ZeroTrustAccessIdentityProvider("pin_login",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="PIN login",
 *     type="onetimepin")
 * # oauth
 * github_oauth = cloudflare.ZeroTrustAccessIdentityProvider("github_oauth",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="GitHub OAuth",
 *     type="github",
 *     configs=[{
 *         "client_id": "example",
 *         "client_secret": "secret_key",
 *     }])
 * # saml
 * jumpcloud_saml = cloudflare.ZeroTrustAccessIdentityProvider("jumpcloud_saml",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="JumpCloud SAML",
 *     type="saml",
 *     configs=[{
 *         "issuer_url": "jumpcloud",
 *         "sso_target_url": "https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess",
 *         "attributes": [
 *             "email",
 *             "username",
 *         ],
 *         "sign_request": False,
 *         "idp_public_cert": """MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg
 * uTnQyuOqPuHbnN83d/2l1NSYKCbHt24o""",
 *     }])
 * # okta
 * okta = cloudflare.ZeroTrustAccessIdentityProvider("okta",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="Okta",
 *     type="okta",
 *     configs=[{
 *         "client_id": "example",
 *         "client_secret": "secret_key",
 *         "api_token": "okta_api_token",
 *         "okta_account": "https://example.com",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // one time pin
 *     var pinLogin = new Cloudflare.ZeroTrustAccessIdentityProvider("pin_login", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "PIN login",
 *         Type = "onetimepin",
 *     });
 *     // oauth
 *     var githubOauth = new Cloudflare.ZeroTrustAccessIdentityProvider("github_oauth", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "GitHub OAuth",
 *         Type = "github",
 *         Configs = new[]
 *         {
 *             new Cloudflare.Inputs.ZeroTrustAccessIdentityProviderConfigArgs
 *             {
 *                 ClientId = "example",
 *                 ClientSecret = "secret_key",
 *             },
 *         },
 *     });
 *     // saml
 *     var jumpcloudSaml = new Cloudflare.ZeroTrustAccessIdentityProvider("jumpcloud_saml", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "JumpCloud SAML",
 *         Type = "saml",
 *         Configs = new[]
 *         {
 *             new Cloudflare.Inputs.ZeroTrustAccessIdentityProviderConfigArgs
 *             {
 *                 IssuerUrl = "jumpcloud",
 *                 SsoTargetUrl = "https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess",
 *                 Attributes = new[]
 *                 {
 *                     "email",
 *                     "username",
 *                 },
 *                 SignRequest = false,
 *                 IdpPublicCert = @"MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg
 * uTnQyuOqPuHbnN83d/2l1NSYKCbHt24o",
 *             },
 *         },
 *     });
 *     // okta
 *     var okta = new Cloudflare.ZeroTrustAccessIdentityProvider("okta", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "Okta",
 *         Type = "okta",
 *         Configs = new[]
 *         {
 *             new Cloudflare.Inputs.ZeroTrustAccessIdentityProviderConfigArgs
 *             {
 *                 ClientId = "example",
 *                 ClientSecret = "secret_key",
 *                 ApiToken = "okta_api_token",
 *                 OktaAccount = "https://example.com",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		// one time pin
 * 		_, err := cloudflare.NewZeroTrustAccessIdentityProvider(ctx, "pin_login", &cloudflare.ZeroTrustAccessIdentityProviderArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:      pulumi.String("PIN login"),
 * 			Type:      pulumi.String("onetimepin"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// oauth
 * 		_, err = cloudflare.NewZeroTrustAccessIdentityProvider(ctx, "github_oauth", &cloudflare.ZeroTrustAccessIdentityProviderArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:      pulumi.String("GitHub OAuth"),
 * 			Type:      pulumi.String("github"),
 * 			Configs: cloudflare.ZeroTrustAccessIdentityProviderConfigArray{
 * 				&cloudflare.ZeroTrustAccessIdentityProviderConfigArgs{
 * 					ClientId:     pulumi.String("example"),
 * 					ClientSecret: pulumi.String("secret_key"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// saml
 * 		_, err = cloudflare.NewZeroTrustAccessIdentityProvider(ctx, "jumpcloud_saml", &cloudflare.ZeroTrustAccessIdentityProviderArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:      pulumi.String("JumpCloud SAML"),
 * 			Type:      pulumi.String("saml"),
 * 			Configs: cloudflare.ZeroTrustAccessIdentityProviderConfigArray{
 * 				&cloudflare.ZeroTrustAccessIdentityProviderConfigArgs{
 * 					IssuerUrl:    pulumi.String("jumpcloud"),
 * 					SsoTargetUrl: pulumi.String("https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess"),
 * 					Attributes: pulumi.StringArray{
 * 						pulumi.String("email"),
 * 						pulumi.String("username"),
 * 					},
 * 					SignRequest:   pulumi.Bool(false),
 * 					IdpPublicCert: pulumi.String("MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg\nuTnQyuOqPuHbnN83d/2l1NSYKCbHt24o"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// okta
 * 		_, err = cloudflare.NewZeroTrustAccessIdentityProvider(ctx, "okta", &cloudflare.ZeroTrustAccessIdentityProviderArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:      pulumi.String("Okta"),
 * 			Type:      pulumi.String("okta"),
 * 			Configs: cloudflare.ZeroTrustAccessIdentityProviderConfigArray{
 * 				&cloudflare.ZeroTrustAccessIdentityProviderConfigArgs{
 * 					ClientId:     pulumi.String("example"),
 * 					ClientSecret: pulumi.String("secret_key"),
 * 					ApiToken:     pulumi.String("okta_api_token"),
 * 					OktaAccount:  pulumi.String("https://example.com"),
 * 				},
 * 			},
 * 		})
 * 		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.cloudflare.ZeroTrustAccessIdentityProvider;
 * import com.pulumi.cloudflare.ZeroTrustAccessIdentityProviderArgs;
 * import com.pulumi.cloudflare.inputs.ZeroTrustAccessIdentityProviderConfigArgs;
 * 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) {
 *         // one time pin
 *         var pinLogin = new ZeroTrustAccessIdentityProvider("pinLogin", ZeroTrustAccessIdentityProviderArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("PIN login")
 *             .type("onetimepin")
 *             .build());
 *         // oauth
 *         var githubOauth = new ZeroTrustAccessIdentityProvider("githubOauth", ZeroTrustAccessIdentityProviderArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("GitHub OAuth")
 *             .type("github")
 *             .configs(ZeroTrustAccessIdentityProviderConfigArgs.builder()
 *                 .clientId("example")
 *                 .clientSecret("secret_key")
 *                 .build())
 *             .build());
 *         // saml
 *         var jumpcloudSaml = new ZeroTrustAccessIdentityProvider("jumpcloudSaml", ZeroTrustAccessIdentityProviderArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("JumpCloud SAML")
 *             .type("saml")
 *             .configs(ZeroTrustAccessIdentityProviderConfigArgs.builder()
 *                 .issuerUrl("jumpcloud")
 *                 .ssoTargetUrl("https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess")
 *                 .attributes(
 *                     "email",
 *                     "username")
 *                 .signRequest(false)
 *                 .idpPublicCert("""
 * MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg
 * uTnQyuOqPuHbnN83d/2l1NSYKCbHt24o                """)
 *                 .build())
 *             .build());
 *         // okta
 *         var okta = new ZeroTrustAccessIdentityProvider("okta", ZeroTrustAccessIdentityProviderArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("Okta")
 *             .type("okta")
 *             .configs(ZeroTrustAccessIdentityProviderConfigArgs.builder()
 *                 .clientId("example")
 *                 .clientSecret("secret_key")
 *                 .apiToken("okta_api_token")
 *                 .oktaAccount("https://example.com")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # one time pin
 *   pinLogin:
 *     type: cloudflare:ZeroTrustAccessIdentityProvider
 *     name: pin_login
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: PIN login
 *       type: onetimepin
 *   # oauth
 *   githubOauth:
 *     type: cloudflare:ZeroTrustAccessIdentityProvider
 *     name: github_oauth
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: GitHub OAuth
 *       type: github
 *       configs:
 *         - clientId: example
 *           clientSecret: secret_key
 *   # saml
 *   jumpcloudSaml:
 *     type: cloudflare:ZeroTrustAccessIdentityProvider
 *     name: jumpcloud_saml
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: JumpCloud SAML
 *       type: saml
 *       configs:
 *         - issuerUrl: jumpcloud
 *           ssoTargetUrl: https://sso.myexample.jumpcloud.com/saml2/cloudflareaccess
 *           attributes:
 *             - email
 *             - username
 *           signRequest: false
 *           idpPublicCert: |-
 *             MIIDpDCCAoygAwIBAgIGAV2ka+55MA0GCSqGSIb3DQEBCwUAMIGSMQswCQ...GF/Q2/MHadws97cZg
 *             uTnQyuOqPuHbnN83d/2l1NSYKCbHt24o
 *   # okta
 *   okta:
 *     type: cloudflare:ZeroTrustAccessIdentityProvider
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: Okta
 *       type: okta
 *       configs:
 *         - clientId: example
 *           clientSecret: secret_key
 *           apiToken: okta_api_token
 *           oktaAccount: https://example.com
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/zeroTrustAccessIdentityProvider:ZeroTrustAccessIdentityProvider example /
 * ```
 */
public class ZeroTrustAccessIdentityProvider internal constructor(
    override val javaResource: com.pulumi.cloudflare.ZeroTrustAccessIdentityProvider,
) : KotlinCustomResource(javaResource, ZeroTrustAccessIdentityProviderMapper) {
    /**
     * The account identifier to target for the resource. Conflicts with `zone_id`. **Modifying this attribute will force creation of a new resource.**
     */
    public val accountId: Output?
        get() = javaResource.accountId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Provider configuration from the [developer documentation](https://developers.cloudflare.com/access/configuring-identity-providers/).
     */
    public val configs: Output>
        get() = javaResource.configs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    zeroTrustAccessIdentityProviderConfigToKotlin(args0)
                })
            })
        })

    /**
     * Friendly name of the Access Identity Provider configuration.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Configuration for SCIM settings for a given IDP.
     */
    public val scimConfigs: Output>
        get() = javaResource.scimConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    zeroTrustAccessIdentityProviderScimConfigToKotlin(args0)
                })
            })
        })

    /**
     * The provider type to use. Available values: `azureAD`, `centrify`, `facebook`, `github`, `google`, `google-apps`, `linkedin`, `oidc`, `okta`, `onelogin`, `onetimepin`, `pingone`, `saml`, `yandex`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * The zone identifier to target for the resource. Conflicts with `account_id`. **Modifying this attribute will force creation of a new resource.**
     */
    public val zoneId: Output?
        get() = javaResource.zoneId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object ZeroTrustAccessIdentityProviderMapper :
    ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.ZeroTrustAccessIdentityProvider::class == javaResource::class

    override fun map(javaResource: Resource): ZeroTrustAccessIdentityProvider =
        ZeroTrustAccessIdentityProvider(
            javaResource as
                com.pulumi.cloudflare.ZeroTrustAccessIdentityProvider,
        )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy