gcp.projects.ApiKey
The Apikeys Key resource
Example Usage
Android_key
using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Organizations.Project("basic", new()
{
ProjectId = "app",
OrgId = "123456789",
});
var primary = new Gcp.Projects.ApiKey("primary", new()
{
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*",
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v6/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"),
OrgId: pulumi.String("123456789"),
})
if err != nil {
return err
}
_, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
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
})
}
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")
.orgId("123456789")
.build());
var primary = new ApiKey("primary", ApiKeyArgs.builder()
.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());
}
}
import pulumi
import pulumi_gcp as gcp
basic = gcp.organizations.Project("basic",
project_id="app",
org_id="123456789")
primary = gcp.projects.ApiKey("primary",
display_name="sample-key",
project=basic.name,
restrictions=gcp.projects.ApiKeyRestrictionsArgs(
android_key_restrictions=gcp.projects.ApiKeyRestrictionsAndroidKeyRestrictionsArgs(
allowed_applications=[gcp.projects.ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplicationArgs(
package_name="com.example.app123",
sha1_fingerprint="1699466a142d4682a5f91b50fdf400f2358e2b0b",
)],
),
api_targets=[gcp.projects.ApiKeyRestrictionsApiTargetArgs(
service="translate.googleapis.com",
methods=["GET*"],
)],
))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.organizations.Project("basic", {
projectId: "app",
orgId: "123456789",
});
const primary = new gcp.projects.ApiKey("primary", {
displayName: "sample-key",
project: basic.name,
restrictions: {
androidKeyRestrictions: {
allowedApplications: [{
packageName: "com.example.app123",
sha1Fingerprint: "1699466a142d4682a5f91b50fdf400f2358e2b0b",
}],
},
apiTargets: [{
service: "translate.googleapis.com",
methods: ["GET*"],
}],
},
});
resources:
primary:
type: gcp:projects:ApiKey
properties:
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
orgId: '123456789'
Basic_key
using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Organizations.Project("basic", new()
{
ProjectId = "app",
OrgId = "123456789",
});
var primary = new Gcp.Projects.ApiKey("primary", new()
{
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[]
{
".*",
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v6/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"),
OrgId: pulumi.String("123456789"),
})
if err != nil {
return err
}
_, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
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
})
}
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")
.orgId("123456789")
.build());
var primary = new ApiKey("primary", ApiKeyArgs.builder()
.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());
}
}
import pulumi
import pulumi_gcp as gcp
basic = gcp.organizations.Project("basic",
project_id="app",
org_id="123456789")
primary = gcp.projects.ApiKey("primary",
display_name="sample-key",
project=basic.name,
restrictions=gcp.projects.ApiKeyRestrictionsArgs(
api_targets=[gcp.projects.ApiKeyRestrictionsApiTargetArgs(
service="translate.googleapis.com",
methods=["GET*"],
)],
browser_key_restrictions=gcp.projects.ApiKeyRestrictionsBrowserKeyRestrictionsArgs(
allowed_referrers=[".*"],
),
))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.organizations.Project("basic", {
projectId: "app",
orgId: "123456789",
});
const primary = new gcp.projects.ApiKey("primary", {
displayName: "sample-key",
project: basic.name,
restrictions: {
apiTargets: [{
service: "translate.googleapis.com",
methods: ["GET*"],
}],
browserKeyRestrictions: {
allowedReferrers: [".*"],
},
},
});
resources:
primary:
type: gcp:projects:ApiKey
properties:
displayName: sample-key
project: ${basic.name}
restrictions:
apiTargets:
- service: translate.googleapis.com
methods:
- GET*
browserKeyRestrictions:
allowedReferrers:
- .*
basic:
type: gcp:organizations:Project
properties:
projectId: app
orgId: '123456789'
Ios_key
using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Organizations.Project("basic", new()
{
ProjectId = "app",
OrgId = "123456789",
});
var primary = new Gcp.Projects.ApiKey("primary", new()
{
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",
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v6/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"),
OrgId: pulumi.String("123456789"),
})
if err != nil {
return err
}
_, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
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
})
}
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")
.orgId("123456789")
.build());
var primary = new ApiKey("primary", ApiKeyArgs.builder()
.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());
}
}
import pulumi
import pulumi_gcp as gcp
basic = gcp.organizations.Project("basic",
project_id="app",
org_id="123456789")
primary = gcp.projects.ApiKey("primary",
display_name="sample-key",
project=basic.name,
restrictions=gcp.projects.ApiKeyRestrictionsArgs(
api_targets=[gcp.projects.ApiKeyRestrictionsApiTargetArgs(
service="translate.googleapis.com",
methods=["GET*"],
)],
ios_key_restrictions=gcp.projects.ApiKeyRestrictionsIosKeyRestrictionsArgs(
allowed_bundle_ids=["com.google.app.macos"],
),
))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.organizations.Project("basic", {
projectId: "app",
orgId: "123456789",
});
const primary = new gcp.projects.ApiKey("primary", {
displayName: "sample-key",
project: basic.name,
restrictions: {
apiTargets: [{
service: "translate.googleapis.com",
methods: ["GET*"],
}],
iosKeyRestrictions: {
allowedBundleIds: ["com.google.app.macos"],
},
},
});
resources:
primary:
type: gcp:projects:ApiKey
properties:
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
orgId: '123456789'
Minimal_key
using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Organizations.Project("basic", new()
{
ProjectId = "app",
OrgId = "123456789",
});
var primary = new Gcp.Projects.ApiKey("primary", new()
{
DisplayName = "sample-key",
Project = basic.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v6/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"),
OrgId: pulumi.String("123456789"),
})
if err != nil {
return err
}
_, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
DisplayName: pulumi.String("sample-key"),
Project: basic.Name,
})
if err != nil {
return err
}
return nil
})
}
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")
.orgId("123456789")
.build());
var primary = new ApiKey("primary", ApiKeyArgs.builder()
.displayName("sample-key")
.project(basic.name())
.build());
}
}
import pulumi
import pulumi_gcp as gcp
basic = gcp.organizations.Project("basic",
project_id="app",
org_id="123456789")
primary = gcp.projects.ApiKey("primary",
display_name="sample-key",
project=basic.name)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.organizations.Project("basic", {
projectId: "app",
orgId: "123456789",
});
const primary = new gcp.projects.ApiKey("primary", {
displayName: "sample-key",
project: basic.name,
});
resources:
primary:
type: gcp:projects:ApiKey
properties:
displayName: sample-key
project: ${basic.name}
basic:
type: gcp:organizations:Project
properties:
projectId: app
orgId: '123456789'
Server_key
using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Organizations.Project("basic", new()
{
ProjectId = "app",
OrgId = "123456789",
});
var primary = new Gcp.Projects.ApiKey("primary", new()
{
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",
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v6/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"),
OrgId: pulumi.String("123456789"),
})
if err != nil {
return err
}
_, err = projects.NewApiKey(ctx, "primary", &projects.ApiKeyArgs{
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
})
}
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")
.orgId("123456789")
.build());
var primary = new ApiKey("primary", ApiKeyArgs.builder()
.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());
}
}
import pulumi
import pulumi_gcp as gcp
basic = gcp.organizations.Project("basic",
project_id="app",
org_id="123456789")
primary = gcp.projects.ApiKey("primary",
display_name="sample-key",
project=basic.name,
restrictions=gcp.projects.ApiKeyRestrictionsArgs(
api_targets=[gcp.projects.ApiKeyRestrictionsApiTargetArgs(
service="translate.googleapis.com",
methods=["GET*"],
)],
server_key_restrictions=gcp.projects.ApiKeyRestrictionsServerKeyRestrictionsArgs(
allowed_ips=["127.0.0.1"],
),
))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.organizations.Project("basic", {
projectId: "app",
orgId: "123456789",
});
const primary = new gcp.projects.ApiKey("primary", {
displayName: "sample-key",
project: basic.name,
restrictions: {
apiTargets: [{
service: "translate.googleapis.com",
methods: ["GET*"],
}],
serverKeyRestrictions: {
allowedIps: ["127.0.0.1"],
},
},
});
resources:
primary:
type: gcp:projects:ApiKey
properties:
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
orgId: '123456789'
Create ApiKey Resource
new ApiKey(name: string, args?: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
restrictions: Optional[ApiKeyRestrictionsArgs] = None)
@overload
def ApiKey(resource_name: str,
args: Optional[ApiKeyArgs] = None,
opts: Optional[ResourceOptions] = None)
func NewApiKey(ctx *Context, name string, args *ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs? args = null, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: gcp:projects:ApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ApiKey Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ApiKey resource accepts the following input properties:
- Display
Name string Human-readable display name of this API key. Modifiable by user.
- Name string
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?
.- Project string
The project for the resource
- Restrictions
Api
Key Restrictions Args Key restrictions.
- Display
Name string Human-readable display name of this API key. Modifiable by user.
- Name string
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?
.- Project string
The project for the resource
- Restrictions
Api
Key Restrictions Args Key restrictions.
- display
Name String Human-readable display name of this API key. Modifiable by user.
- name String
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?
.- project String
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- display
Name string Human-readable display name of this API key. Modifiable by user.
- name string
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?
.- project string
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- display_
name str Human-readable display name of this API key. Modifiable by user.
- name str
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?
.- project str
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- display
Name String Human-readable display name of this API key. Modifiable by user.
- name String
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?
.- project String
The project for the resource
- restrictions Property Map
Key restrictions.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:
- id str
The provider-assigned unique ID for this managed resource.
- key_
string str Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- uid str
Output only. Unique id in UUID4 format.
Look up Existing ApiKey Resource
Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
key_string: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
restrictions: Optional[ApiKeyRestrictionsArgs] = None,
uid: Optional[str] = None) -> ApiKey
func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Display
Name string Human-readable display name of this API key. Modifiable by user.
- Key
String string Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- Name string
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?
.- Project string
The project for the resource
- Restrictions
Api
Key Restrictions Args Key restrictions.
- Uid string
Output only. Unique id in UUID4 format.
- Display
Name string Human-readable display name of this API key. Modifiable by user.
- Key
String string Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- Name string
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?
.- Project string
The project for the resource
- Restrictions
Api
Key Restrictions Args Key restrictions.
- Uid string
Output only. Unique id in UUID4 format.
- display
Name String Human-readable display name of this API key. Modifiable by user.
- key
String String Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- name String
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?
.- project String
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- uid String
Output only. Unique id in UUID4 format.
- display
Name string Human-readable display name of this API key. Modifiable by user.
- key
String string Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- name string
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?
.- project string
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- uid string
Output only. Unique id in UUID4 format.
- display_
name str Human-readable display name of this API key. Modifiable by user.
- key_
string str Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- name str
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?
.- project str
The project for the resource
- restrictions
Api
Key Restrictions Args Key restrictions.
- uid str
Output only. Unique id in UUID4 format.
- display
Name String Human-readable display name of this API key. Modifiable by user.
- key
String String Output only. An encrypted and signed value held by this key. This field can be accessed only through the
GetKeyString
method.- name String
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?
.- project String
The project for the resource
- restrictions Property Map
Key restrictions.
- uid String
Output only. Unique id in UUID4 format.
Supporting Types
ApiKeyRestrictions
- Android
Key ApiRestrictions Key Restrictions Android Key Restrictions The Android apps that are allowed to use the key.
- Api
Targets List<ApiKey Restrictions Api Target> A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- Browser
Key ApiRestrictions Key Restrictions Browser Key Restrictions The HTTP referrers (websites) that are allowed to use the key.
- Ios
Key ApiRestrictions Key Restrictions Ios Key Restrictions The iOS apps that are allowed to use the key.
- Server
Key ApiRestrictions Key Restrictions Server Key Restrictions The IP addresses of callers that are allowed to use the key.
- Android
Key ApiRestrictions Key Restrictions Android Key Restrictions The Android apps that are allowed to use the key.
- Api
Targets []ApiKey Restrictions Api Target A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- Browser
Key ApiRestrictions Key Restrictions Browser Key Restrictions The HTTP referrers (websites) that are allowed to use the key.
- Ios
Key ApiRestrictions Key Restrictions Ios Key Restrictions The iOS apps that are allowed to use the key.
- Server
Key ApiRestrictions Key Restrictions Server Key Restrictions The IP addresses of callers that are allowed to use the key.
- android
Key ApiRestrictions Key Restrictions Android Key Restrictions The Android apps that are allowed to use the key.
- api
Targets List<ApiKey Restrictions Api Target> A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- browser
Key ApiRestrictions Key Restrictions Browser Key Restrictions The HTTP referrers (websites) that are allowed to use the key.
- ios
Key ApiRestrictions Key Restrictions Ios Key Restrictions The iOS apps that are allowed to use the key.
- server
Key ApiRestrictions Key Restrictions Server Key Restrictions The IP addresses of callers that are allowed to use the key.
- android
Key ApiRestrictions Key Restrictions Android Key Restrictions The Android apps that are allowed to use the key.
- api
Targets ApiKey Restrictions Api Target[] A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- browser
Key ApiRestrictions Key Restrictions Browser Key Restrictions The HTTP referrers (websites) that are allowed to use the key.
- ios
Key ApiRestrictions Key Restrictions Ios Key Restrictions The iOS apps that are allowed to use the key.
- server
Key ApiRestrictions Key Restrictions Server Key Restrictions The IP addresses of callers that are allowed to use the key.
- android_
key_ Apirestrictions Key Restrictions Android Key Restrictions The Android apps that are allowed to use the key.
- api_
targets Sequence[ApiKey Restrictions Api Target] A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- browser_
key_ Apirestrictions Key Restrictions Browser Key Restrictions The HTTP referrers (websites) that are allowed to use the key.
- ios_
key_ Apirestrictions Key Restrictions Ios Key Restrictions The iOS apps that are allowed to use the key.
- server_
key_ Apirestrictions Key Restrictions Server Key Restrictions The IP addresses of callers that are allowed to use the key.
- android
Key Property MapRestrictions The Android apps that are allowed to use the key.
- api
Targets List<Property Map> A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
- browser
Key Property MapRestrictions The HTTP referrers (websites) that are allowed to use the key.
- ios
Key Property MapRestrictions The iOS apps that are allowed to use the key.
- server
Key Property MapRestrictions The IP addresses of callers that are allowed to use the key.
ApiKeyRestrictionsAndroidKeyRestrictions
- Allowed
Applications List<ApiKey Restrictions Android Key Restrictions Allowed Application> A list of Android applications that are allowed to make API calls with this key.
- Allowed
Applications []ApiKey Restrictions Android Key Restrictions Allowed Application A list of Android applications that are allowed to make API calls with this key.
- allowed
Applications List<ApiKey Restrictions Android Key Restrictions Allowed Application> A list of Android applications that are allowed to make API calls with this key.
- allowed
Applications ApiKey Restrictions Android Key Restrictions Allowed Application[] A list of Android applications that are allowed to make API calls with this key.
- allowed_
applications Sequence[ApiKey Restrictions Android Key Restrictions Allowed Application] A list of Android applications that are allowed to make API calls with this key.
- allowed
Applications List<Property Map> A list of Android applications that are allowed to make API calls with this key.
ApiKeyRestrictionsAndroidKeyRestrictionsAllowedApplication
- Package
Name string The package name of the application.
- Sha1Fingerprint string
The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
- Package
Name string The package name of the application.
- Sha1Fingerprint string
The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
- package
Name String The package name of the application.
- sha1Fingerprint String
The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
- package
Name string The package name of the application.
- sha1Fingerprint string
The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
- package_
name str The package name of the application.
- sha1_
fingerprint str The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
- package
Name String The package name of the application.
- sha1Fingerprint String
The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
ApiKeyRestrictionsApiTarget
- Service string
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- Methods List<string>
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
- Service string
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- Methods []string
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
- service String
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- methods List<String>
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
- service string
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- methods string[]
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
- service str
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- methods Sequence[str]
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
- service String
The service for this restriction. It should be the canonical service name, for example:
translate.googleapis.com
. You can usegcloud services list
to get a list of services that are enabled in the project.- methods List<String>
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples:
google.cloud.translate.v2.TranslateService.GetSupportedLanguage
TranslateText
Get*
translate.googleapis.com.Get*
ApiKeyRestrictionsBrowserKeyRestrictions
- Allowed
Referrers List<string> A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
- Allowed
Referrers []string A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
- allowed
Referrers List<String> A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
- allowed
Referrers string[] A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
- allowed_
referrers Sequence[str] A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
- allowed
Referrers List<String> A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
ApiKeyRestrictionsIosKeyRestrictions
- Allowed
Bundle List<string>Ids A list of bundle IDs that are allowed when making API calls with this key.
- Allowed
Bundle []stringIds A list of bundle IDs that are allowed when making API calls with this key.
- allowed
Bundle List<String>Ids A list of bundle IDs that are allowed when making API calls with this key.
- allowed
Bundle string[]Ids A list of bundle IDs that are allowed when making API calls with this key.
- allowed_
bundle_ Sequence[str]ids A list of bundle IDs that are allowed when making API calls with this key.
- allowed
Bundle List<String>Ids A list of bundle IDs that are allowed when making API calls with this key.
ApiKeyRestrictionsServerKeyRestrictions
- Allowed
Ips List<string> A list of the caller IP addresses that are allowed to make API calls with this key.
- Allowed
Ips []string A list of the caller IP addresses that are allowed to make API calls with this key.
- allowed
Ips List<String> A list of the caller IP addresses that are allowed to make API calls with this key.
- allowed
Ips string[] A list of the caller IP addresses that are allowed to make API calls with this key.
- allowed_
ips Sequence[str] A list of the caller IP addresses that are allowed to make API calls with this key.
- allowed
Ips List<String> A list of the caller IP addresses that are allowed to make API calls with this key.
Import
Key can be imported using any of these accepted formats
$ pulumi import gcp:projects/apiKey:ApiKey default projects/{{project}}/locations/global/keys/{{name}}
$ pulumi import gcp:projects/apiKey:ApiKey default {{project}}/{{name}}
$ pulumi import gcp:projects/apiKey:ApiKey default {{name}}
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.