Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.projects.kotlin.ApiKeyArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.projects.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.projects.ApiKeyArgs.builder
import com.pulumi.gcp.projects.kotlin.inputs.ApiKeyRestrictionsArgs
import com.pulumi.gcp.projects.kotlin.inputs.ApiKeyRestrictionsArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* The Apikeys Key resource
* ## Example Usage
* ### Android_key
* A basic example of a android api keys key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "app",
* name: "app",
* orgId: "123456789",
* });
* const primary = new gcp.projects.ApiKey("primary", {
* name: "key",
* displayName: "sample-key",
* project: basic.name,
* restrictions: {
* androidKeyRestrictions: {
* allowedApplications: [{
* packageName: "com.example.app123",
* sha1Fingerprint: "1699466a142d4682a5f91b50fdf400f2358e2b0b",
* }],
* },
* apiTargets: [{
* service: "translate.googleapis.com",
* methods: ["GET*"],
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="app",
* name="app",
* org_id="123456789")
* primary = gcp.projects.ApiKey("primary",
* name="key",
* display_name="sample-key",
* project=basic.name,
* restrictions={
* "android_key_restrictions": {
* "allowed_applications": [{
* "package_name": "com.example.app123",
* "sha1_fingerprint": "1699466a142d4682a5f91b50fdf400f2358e2b0b",
* }],
* },
* "api_targets": [{
* "service": "translate.googleapis.com",
* "methods": ["GET*"],
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "app",
* Name = "app",
* OrgId = "123456789",
* });
* var primary = new Gcp.Projects.ApiKey("primary", new()
* {
* Name = "key",
* DisplayName = "sample-key",
* Project = basic.Name,
* Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
* {
* AndroidKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsAndroidKeyRestrictionsArgs
* {
* AllowedApplications = new[]
* {
* new Gcp.Projects.Inputs.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs
* {
* PackageName = "com.example.app123",
* Sha1Fingerprint = "1699466a142d4682a5f91b50fdf400f2358e2b0b",
* },
* },
* },
* ApiTargets = new[]
* {
* new Gcp.Projects.Inputs.ApiKeyRestrictionsApiTargetArgs
* {
* Service = "translate.googleapis.com",
* Methods = new[]
* {
* "GET*",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("app"),
* Name: pulumi.String("app"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
* Name: pulumi.String("key"),
* DisplayName: pulumi.String("sample-key"),
* Project: basic.Name,
* Restrictions: &projects.ApiKeyRestrictionsArgs{
* AndroidKeyRestrictions: &projects.ApiKeyRestrictionsAndroidKeyRestrictionsArgs{
* AllowedApplications: projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArray{
* &projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs{
* PackageName: pulumi.String("com.example.app123"),
* Sha1Fingerprint: pulumi.String("1699466a142d4682a5f91b50fdf400f2358e2b0b"),
* },
* },
* },
* ApiTargets: projects.ApiKeyRestrictionsApiTargetArray{
* &projects.ApiKeyRestrictionsApiTargetArgs{
* Service: pulumi.String("translate.googleapis.com"),
* Methods: pulumi.StringArray{
* pulumi.String("GET*"),
* },
* },
* },
* },
* })
* 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.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.projects.ApiKey;
* import com.pulumi.gcp.projects.ApiKeyArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsAndroidKeyRestrictionsArgs;
* 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 basic = new Project("basic", ProjectArgs.builder()
* .projectId("app")
* .name("app")
* .orgId("123456789")
* .build());
* var primary = new ApiKey("primary", ApiKeyArgs.builder()
* .name("key")
* .displayName("sample-key")
* .project(basic.name())
* .restrictions(ApiKeyRestrictionsArgs.builder()
* .androidKeyRestrictions(ApiKeyRestrictionsAndroidKeyRestrictionsArgs.builder()
* .allowedApplications(ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs.builder()
* .packageName("com.example.app123")
* .sha1Fingerprint("1699466a142d4682a5f91b50fdf400f2358e2b0b")
* .build())
* .build())
* .apiTargets(ApiKeyRestrictionsApiTargetArgs.builder()
* .service("translate.googleapis.com")
* .methods("GET*")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:projects:ApiKey
* properties:
* name: key
* displayName: sample-key
* project: ${basic.name}
* restrictions:
* androidKeyRestrictions:
* allowedApplications:
* - packageName: com.example.app123
* sha1Fingerprint: 1699466a142d4682a5f91b50fdf400f2358e2b0b
* apiTargets:
* - service: translate.googleapis.com
* methods:
* - GET*
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: app
* name: app
* orgId: '123456789'
* ```
*
* ### Basic_key
* A basic example of a api keys key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "app",
* name: "app",
* orgId: "123456789",
* });
* const primary = new gcp.projects.ApiKey("primary", {
* name: "key",
* displayName: "sample-key",
* project: basic.name,
* restrictions: {
* apiTargets: [{
* service: "translate.googleapis.com",
* methods: ["GET*"],
* }],
* browserKeyRestrictions: {
* allowedReferrers: [".*"],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="app",
* name="app",
* org_id="123456789")
* primary = gcp.projects.ApiKey("primary",
* name="key",
* display_name="sample-key",
* project=basic.name,
* restrictions={
* "api_targets": [{
* "service": "translate.googleapis.com",
* "methods": ["GET*"],
* }],
* "browser_key_restrictions": {
* "allowed_referrers": [".*"],
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "app",
* Name = "app",
* OrgId = "123456789",
* });
* var primary = new Gcp.Projects.ApiKey("primary", new()
* {
* Name = "key",
* DisplayName = "sample-key",
* Project = basic.Name,
* Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
* {
* ApiTargets = new[]
* {
* new Gcp.Projects.Inputs.ApiKeyRestrictionsApiTargetArgs
* {
* Service = "translate.googleapis.com",
* Methods = new[]
* {
* "GET*",
* },
* },
* },
* BrowserKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsBrowserKeyRestrictionsArgs
* {
* AllowedReferrers = new[]
* {
* ".*",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("app"),
* Name: pulumi.String("app"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
* Name: pulumi.String("key"),
* DisplayName: pulumi.String("sample-key"),
* Project: basic.Name,
* Restrictions: &projects.ApiKeyRestrictionsArgs{
* ApiTargets: projects.ApiKeyRestrictionsApiTargetArray{
* &projects.ApiKeyRestrictionsApiTargetArgs{
* Service: pulumi.String("translate.googleapis.com"),
* Methods: pulumi.StringArray{
* pulumi.String("GET*"),
* },
* },
* },
* BrowserKeyRestrictions: &projects.ApiKeyRestrictionsBrowserKeyRestrictionsArgs{
* AllowedReferrers: pulumi.StringArray{
* pulumi.String(".*"),
* },
* },
* },
* })
* 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.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.projects.ApiKey;
* import com.pulumi.gcp.projects.ApiKeyArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsBrowserKeyRestrictionsArgs;
* 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 basic = new Project("basic", ProjectArgs.builder()
* .projectId("app")
* .name("app")
* .orgId("123456789")
* .build());
* var primary = new ApiKey("primary", ApiKeyArgs.builder()
* .name("key")
* .displayName("sample-key")
* .project(basic.name())
* .restrictions(ApiKeyRestrictionsArgs.builder()
* .apiTargets(ApiKeyRestrictionsApiTargetArgs.builder()
* .service("translate.googleapis.com")
* .methods("GET*")
* .build())
* .browserKeyRestrictions(ApiKeyRestrictionsBrowserKeyRestrictionsArgs.builder()
* .allowedReferrers(".*")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:projects:ApiKey
* properties:
* name: key
* displayName: sample-key
* project: ${basic.name}
* restrictions:
* apiTargets:
* - service: translate.googleapis.com
* methods:
* - GET*
* browserKeyRestrictions:
* allowedReferrers:
* - .*
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: app
* name: app
* orgId: '123456789'
* ```
*
* ### Ios_key
* A basic example of a ios api keys key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "app",
* name: "app",
* orgId: "123456789",
* });
* const primary = new gcp.projects.ApiKey("primary", {
* name: "key",
* displayName: "sample-key",
* project: basic.name,
* restrictions: {
* apiTargets: [{
* service: "translate.googleapis.com",
* methods: ["GET*"],
* }],
* iosKeyRestrictions: {
* allowedBundleIds: ["com.google.app.macos"],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="app",
* name="app",
* org_id="123456789")
* primary = gcp.projects.ApiKey("primary",
* name="key",
* display_name="sample-key",
* project=basic.name,
* restrictions={
* "api_targets": [{
* "service": "translate.googleapis.com",
* "methods": ["GET*"],
* }],
* "ios_key_restrictions": {
* "allowed_bundle_ids": ["com.google.app.macos"],
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "app",
* Name = "app",
* OrgId = "123456789",
* });
* var primary = new Gcp.Projects.ApiKey("primary", new()
* {
* Name = "key",
* DisplayName = "sample-key",
* Project = basic.Name,
* Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
* {
* ApiTargets = new[]
* {
* new Gcp.Projects.Inputs.ApiKeyRestrictionsApiTargetArgs
* {
* Service = "translate.googleapis.com",
* Methods = new[]
* {
* "GET*",
* },
* },
* },
* IosKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsIosKeyRestrictionsArgs
* {
* AllowedBundleIds = new[]
* {
* "com.google.app.macos",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("app"),
* Name: pulumi.String("app"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
* Name: pulumi.String("key"),
* DisplayName: pulumi.String("sample-key"),
* Project: basic.Name,
* Restrictions: &projects.ApiKeyRestrictionsArgs{
* ApiTargets: projects.ApiKeyRestrictionsApiTargetArray{
* &projects.ApiKeyRestrictionsApiTargetArgs{
* Service: pulumi.String("translate.googleapis.com"),
* Methods: pulumi.StringArray{
* pulumi.String("GET*"),
* },
* },
* },
* IosKeyRestrictions: &projects.ApiKeyRestrictionsIosKeyRestrictionsArgs{
* AllowedBundleIds: pulumi.StringArray{
* pulumi.String("com.google.app.macos"),
* },
* },
* },
* })
* 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.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.projects.ApiKey;
* import com.pulumi.gcp.projects.ApiKeyArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsIosKeyRestrictionsArgs;
* 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 basic = new Project("basic", ProjectArgs.builder()
* .projectId("app")
* .name("app")
* .orgId("123456789")
* .build());
* var primary = new ApiKey("primary", ApiKeyArgs.builder()
* .name("key")
* .displayName("sample-key")
* .project(basic.name())
* .restrictions(ApiKeyRestrictionsArgs.builder()
* .apiTargets(ApiKeyRestrictionsApiTargetArgs.builder()
* .service("translate.googleapis.com")
* .methods("GET*")
* .build())
* .iosKeyRestrictions(ApiKeyRestrictionsIosKeyRestrictionsArgs.builder()
* .allowedBundleIds("com.google.app.macos")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:projects:ApiKey
* properties:
* name: key
* displayName: sample-key
* project: ${basic.name}
* restrictions:
* apiTargets:
* - service: translate.googleapis.com
* methods:
* - GET*
* iosKeyRestrictions:
* allowedBundleIds:
* - com.google.app.macos
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: app
* name: app
* orgId: '123456789'
* ```
*
* ### Minimal_key
* A minimal example of a api keys key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "app",
* name: "app",
* orgId: "123456789",
* });
* const primary = new gcp.projects.ApiKey("primary", {
* name: "key",
* displayName: "sample-key",
* project: basic.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="app",
* name="app",
* org_id="123456789")
* primary = gcp.projects.ApiKey("primary",
* name="key",
* display_name="sample-key",
* project=basic.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "app",
* Name = "app",
* OrgId = "123456789",
* });
* var primary = new Gcp.Projects.ApiKey("primary", new()
* {
* Name = "key",
* DisplayName = "sample-key",
* Project = basic.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("app"),
* Name: pulumi.String("app"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
* Name: pulumi.String("key"),
* DisplayName: pulumi.String("sample-key"),
* Project: basic.Name,
* })
* 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.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.projects.ApiKey;
* import com.pulumi.gcp.projects.ApiKeyArgs;
* 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 basic = new Project("basic", ProjectArgs.builder()
* .projectId("app")
* .name("app")
* .orgId("123456789")
* .build());
* var primary = new ApiKey("primary", ApiKeyArgs.builder()
* .name("key")
* .displayName("sample-key")
* .project(basic.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:projects:ApiKey
* properties:
* name: key
* displayName: sample-key
* project: ${basic.name}
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: app
* name: app
* orgId: '123456789'
* ```
*
* ### Server_key
* A basic example of a server api keys key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.organizations.Project("basic", {
* projectId: "app",
* name: "app",
* orgId: "123456789",
* });
* const primary = new gcp.projects.ApiKey("primary", {
* name: "key",
* displayName: "sample-key",
* project: basic.name,
* restrictions: {
* apiTargets: [{
* service: "translate.googleapis.com",
* methods: ["GET*"],
* }],
* serverKeyRestrictions: {
* allowedIps: ["127.0.0.1"],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.organizations.Project("basic",
* project_id="app",
* name="app",
* org_id="123456789")
* primary = gcp.projects.ApiKey("primary",
* name="key",
* display_name="sample-key",
* project=basic.name,
* restrictions={
* "api_targets": [{
* "service": "translate.googleapis.com",
* "methods": ["GET*"],
* }],
* "server_key_restrictions": {
* "allowed_ips": ["127.0.0.1"],
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Organizations.Project("basic", new()
* {
* ProjectId = "app",
* Name = "app",
* OrgId = "123456789",
* });
* var primary = new Gcp.Projects.ApiKey("primary", new()
* {
* Name = "key",
* DisplayName = "sample-key",
* Project = basic.Name,
* Restrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsArgs
* {
* ApiTargets = new[]
* {
* new Gcp.Projects.Inputs.ApiKeyRestrictionsApiTargetArgs
* {
* Service = "translate.googleapis.com",
* Methods = new[]
* {
* "GET*",
* },
* },
* },
* ServerKeyRestrictions = new Gcp.Projects.Inputs.ApiKeyRestrictionsServerKeyRestrictionsArgs
* {
* AllowedIps = new[]
* {
* "127.0.0.1",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := organizations.NewProject(ctx, "basic", &organizations.ProjectArgs{
* ProjectId: pulumi.String("app"),
* Name: pulumi.String("app"),
* OrgId: pulumi.String("123456789"),
* })
* if err != nil {
* return err
* }
* _, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
* Name: pulumi.String("key"),
* DisplayName: pulumi.String("sample-key"),
* Project: basic.Name,
* Restrictions: &projects.ApiKeyRestrictionsArgs{
* ApiTargets: projects.ApiKeyRestrictionsApiTargetArray{
* &projects.ApiKeyRestrictionsApiTargetArgs{
* Service: pulumi.String("translate.googleapis.com"),
* Methods: pulumi.StringArray{
* pulumi.String("GET*"),
* },
* },
* },
* ServerKeyRestrictions: &projects.ApiKeyRestrictionsServerKeyRestrictionsArgs{
* AllowedIps: pulumi.StringArray{
* pulumi.String("127.0.0.1"),
* },
* },
* },
* })
* 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.gcp.organizations.Project;
* import com.pulumi.gcp.organizations.ProjectArgs;
* import com.pulumi.gcp.projects.ApiKey;
* import com.pulumi.gcp.projects.ApiKeyArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsArgs;
* import com.pulumi.gcp.projects.inputs.ApiKeyRestrictionsServerKeyRestrictionsArgs;
* 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 basic = new Project("basic", ProjectArgs.builder()
* .projectId("app")
* .name("app")
* .orgId("123456789")
* .build());
* var primary = new ApiKey("primary", ApiKeyArgs.builder()
* .name("key")
* .displayName("sample-key")
* .project(basic.name())
* .restrictions(ApiKeyRestrictionsArgs.builder()
* .apiTargets(ApiKeyRestrictionsApiTargetArgs.builder()
* .service("translate.googleapis.com")
* .methods("GET*")
* .build())
* .serverKeyRestrictions(ApiKeyRestrictionsServerKeyRestrictionsArgs.builder()
* .allowedIps("127.0.0.1")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:projects:ApiKey
* properties:
* name: key
* displayName: sample-key
* project: ${basic.name}
* restrictions:
* apiTargets:
* - service: translate.googleapis.com
* methods:
* - GET*
* serverKeyRestrictions:
* allowedIps:
* - 127.0.0.1
* basic:
* type: gcp:organizations:Project
* properties:
* projectId: app
* name: app
* orgId: '123456789'
* ```
*
* ## Import
* Key can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/global/keys/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Key can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:projects/apiKey:ApiKey default projects/{{project}}/locations/global/keys/{{name}}
* ```
* ```sh
* $ pulumi import gcp:projects/apiKey:ApiKey default {{project}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:projects/apiKey:ApiKey default {{name}}
* ```
* @property displayName Human-readable display name of this API key. Modifiable by user.
* @property name The resource name of the key. The name must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the name must match the regular expression: `a-z?`.
* @property project The project for the resource
* @property restrictions Key restrictions.
*/
public data class ApiKeyArgs(
public val displayName: Output? = null,
public val name: Output? = null,
public val project: Output? = null,
public val restrictions: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.projects.ApiKeyArgs =
com.pulumi.gcp.projects.ApiKeyArgs.builder()
.displayName(displayName?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.restrictions(restrictions?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}
/**
* Builder for [ApiKeyArgs].
*/
@PulumiTagMarker
public class ApiKeyArgsBuilder internal constructor() {
private var displayName: Output? = null
private var name: Output? = null
private var project: Output? = null
private var restrictions: Output? = null
/**
* @param value Human-readable display name of this API key. Modifiable by user.
*/
@JvmName("jhyrqsirjrptfrwc")
public suspend fun displayName(`value`: Output) {
this.displayName = value
}
/**
* @param value The resource name of the key. The name must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the name must match the regular expression: `a-z?`.
*/
@JvmName("xjiqlxqwssyyohlx")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The project for the resource
*/
@JvmName("bgrbsuorfpwhvaep")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value Key restrictions.
*/
@JvmName("usvmdjgvghkdomrj")
public suspend fun restrictions(`value`: Output) {
this.restrictions = value
}
/**
* @param value Human-readable display name of this API key. Modifiable by user.
*/
@JvmName("bcuxjxumfjdwkbxe")
public suspend fun displayName(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.displayName = mapped
}
/**
* @param value The resource name of the key. The name must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the name must match the regular expression: `a-z?`.
*/
@JvmName("njgmkladauvrtvfg")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The project for the resource
*/
@JvmName("qdojdwfbaelyhdok")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value Key restrictions.
*/
@JvmName("wmvgvmxohxnikntb")
public suspend fun restrictions(`value`: ApiKeyRestrictionsArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.restrictions = mapped
}
/**
* @param argument Key restrictions.
*/
@JvmName("ucnwisxouvbmlxth")
public suspend fun restrictions(argument: suspend ApiKeyRestrictionsArgsBuilder.() -> Unit) {
val toBeMapped = ApiKeyRestrictionsArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.restrictions = mapped
}
internal fun build(): ApiKeyArgs = ApiKeyArgs(
displayName = displayName,
name = name,
project = project,
restrictions = restrictions,
)
}