1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. ProjectApiKey
Equinix v0.10.0 published on Wednesday, May 22, 2024 by Equinix

equinix.metal.ProjectApiKey

Explore with Pulumi AI

equinix logo
Equinix v0.10.0 published on Wednesday, May 22, 2024 by Equinix

    Use this resource to create Metal Project API Key resources in Equinix Metal. Project API keys can be used to create and read resources in a single project. Each API key contains a token which can be used for authentication in Equinix Metal HTTP API (in HTTP request header X-Auth-Token).

    Read-only keys only allow to list and view existing resources, read-write keys can also be used to create resources.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Equinix = Pulumi.Equinix;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var projectId = config.Require("projectId");
        var readOnly = config.GetBoolean("readOnly") ?? false;
        var apiKey = new Equinix.Metal.ProjectApiKey("apiKey", new()
        {
            ProjectId = projectId,
            Description = "A project level API Key",
            ReadOnly = readOnly,
        });
    
        return new Dictionary<string, object?>
        {
            ["apiKeyToken"] = apiKey.Token,
        };
    });
    
    package main
    
    import (
    	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		projectId := cfg.Require("projectId")
    		readOnly := false
    		if param := cfg.GetBool("readOnly"); param {
    			readOnly = param
    		}
    		apiKey, err := metal.NewProjectApiKey(ctx, "apiKey", &metal.ProjectApiKeyArgs{
    			ProjectId:   pulumi.String(projectId),
    			Description: pulumi.String("A project level API Key"),
    			ReadOnly:    pulumi.Bool(readOnly),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("apiKeyToken", apiKey.Token)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.equinix.pulumi.metal.ProjectApiKey;
    import com.equinix.pulumi.metal.ProjectApiKeyArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var projectId = config.get("projectId").get();
            final var readOnly = config.getBoolean("readOnly").orElse(false);
            var apiKey = new ProjectApiKey("apiKey", ProjectApiKeyArgs.builder()        
                .projectId(projectId)
                .description("A project level API Key")
                .readOnly(readOnly)
                .build());
    
            ctx.export("apiKeyToken", apiKey.token());
        }
    }
    
    import pulumi
    import pulumi_equinix as equinix
    
    config = pulumi.Config()
    project_id = config.require("projectId")
    read_only = config.get_bool("readOnly")
    if read_only is None:
        read_only = False
    api_key = equinix.metal.ProjectApiKey("apiKey",
        project_id=project_id,
        description="A project level API Key",
        read_only=read_only)
    pulumi.export("apiKeyToken", api_key.token)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as equinix from "@equinix-labs/pulumi-equinix";
    
    const config = new pulumi.Config();
    const projectId = config.require("projectId");
    const readOnly = config.getBoolean("readOnly") || false;
    const apiKey = new equinix.metal.ProjectApiKey("apiKey", {
        projectId: projectId,
        description: "A project level API Key",
        readOnly: readOnly,
    });
    export const apiKeyToken = apiKey.token;
    
    config:
      projectId:
        type: string
      readOnly:
        type: boolean
        default: false
    resources:
      apiKey:
        type: equinix:metal:ProjectApiKey
        properties:
          projectId: ${projectId}
          description: A project level API Key
          readOnly: ${readOnly}
    outputs:
      apiKeyToken: ${apiKey.token}
    

    Create ProjectApiKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProjectApiKey(name: string, args: ProjectApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectApiKey(resource_name: str,
                      args: ProjectApiKeyArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectApiKey(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      description: Optional[str] = None,
                      project_id: Optional[str] = None,
                      read_only: Optional[bool] = None)
    func NewProjectApiKey(ctx *Context, name string, args ProjectApiKeyArgs, opts ...ResourceOption) (*ProjectApiKey, error)
    public ProjectApiKey(string name, ProjectApiKeyArgs args, CustomResourceOptions? opts = null)
    public ProjectApiKey(String name, ProjectApiKeyArgs args)
    public ProjectApiKey(String name, ProjectApiKeyArgs args, CustomResourceOptions options)
    
    type: equinix:metal:ProjectApiKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ProjectApiKeyArgs
    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 ProjectApiKeyArgs
    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 ProjectApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectApiKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var projectApiKeyResource = new Equinix.Metal.ProjectApiKey("projectApiKeyResource", new()
    {
        Description = "string",
        ProjectId = "string",
        ReadOnly = false,
    });
    
    example, err := metal.NewProjectApiKey(ctx, "projectApiKeyResource", &metal.ProjectApiKeyArgs{
    	Description: pulumi.String("string"),
    	ProjectId:   pulumi.String("string"),
    	ReadOnly:    pulumi.Bool(false),
    })
    
    var projectApiKeyResource = new ProjectApiKey("projectApiKeyResource", ProjectApiKeyArgs.builder()        
        .description("string")
        .projectId("string")
        .readOnly(false)
        .build());
    
    project_api_key_resource = equinix.metal.ProjectApiKey("projectApiKeyResource",
        description="string",
        project_id="string",
        read_only=False)
    
    const projectApiKeyResource = new equinix.metal.ProjectApiKey("projectApiKeyResource", {
        description: "string",
        projectId: "string",
        readOnly: false,
    });
    
    type: equinix:metal:ProjectApiKey
    properties:
        description: string
        projectId: string
        readOnly: false
    

    ProjectApiKey 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 ProjectApiKey resource accepts the following input properties:

    Description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    ProjectId string
    UUID of the project where the API key is scoped to.
    ReadOnly bool
    Flag indicating whether the API key shoud be read-only
    Description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    ProjectId string
    UUID of the project where the API key is scoped to.
    ReadOnly bool
    Flag indicating whether the API key shoud be read-only
    description String
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId String
    UUID of the project where the API key is scoped to.
    readOnly Boolean
    Flag indicating whether the API key shoud be read-only
    description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId string
    UUID of the project where the API key is scoped to.
    readOnly boolean
    Flag indicating whether the API key shoud be read-only
    description str
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    project_id str
    UUID of the project where the API key is scoped to.
    read_only bool
    Flag indicating whether the API key shoud be read-only
    description String
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId String
    UUID of the project where the API key is scoped to.
    readOnly Boolean
    Flag indicating whether the API key shoud be read-only

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProjectApiKey resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    API token which can be used in Equinix Metal API clients
    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    API token which can be used in Equinix Metal API clients
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    API token which can be used in Equinix Metal API clients
    id string
    The provider-assigned unique ID for this managed resource.
    token string
    API token which can be used in Equinix Metal API clients
    id str
    The provider-assigned unique ID for this managed resource.
    token str
    API token which can be used in Equinix Metal API clients
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    API token which can be used in Equinix Metal API clients

    Look up Existing ProjectApiKey Resource

    Get an existing ProjectApiKey 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?: ProjectApiKeyState, opts?: CustomResourceOptions): ProjectApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            project_id: Optional[str] = None,
            read_only: Optional[bool] = None,
            token: Optional[str] = None) -> ProjectApiKey
    func GetProjectApiKey(ctx *Context, name string, id IDInput, state *ProjectApiKeyState, opts ...ResourceOption) (*ProjectApiKey, error)
    public static ProjectApiKey Get(string name, Input<string> id, ProjectApiKeyState? state, CustomResourceOptions? opts = null)
    public static ProjectApiKey get(String name, Output<String> id, ProjectApiKeyState 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.
    The following state arguments are supported:
    Description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    ProjectId string
    UUID of the project where the API key is scoped to.
    ReadOnly bool
    Flag indicating whether the API key shoud be read-only
    Token string
    API token which can be used in Equinix Metal API clients
    Description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    ProjectId string
    UUID of the project where the API key is scoped to.
    ReadOnly bool
    Flag indicating whether the API key shoud be read-only
    Token string
    API token which can be used in Equinix Metal API clients
    description String
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId String
    UUID of the project where the API key is scoped to.
    readOnly Boolean
    Flag indicating whether the API key shoud be read-only
    token String
    API token which can be used in Equinix Metal API clients
    description string
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId string
    UUID of the project where the API key is scoped to.
    readOnly boolean
    Flag indicating whether the API key shoud be read-only
    token string
    API token which can be used in Equinix Metal API clients
    description str
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    project_id str
    UUID of the project where the API key is scoped to.
    read_only bool
    Flag indicating whether the API key shoud be read-only
    token str
    API token which can be used in Equinix Metal API clients
    description String
    Description string for the Project API Key resource.

    • read-only - (Optional) Flag indicating whether the API key shoud be read-only.
    projectId String
    UUID of the project where the API key is scoped to.
    readOnly Boolean
    Flag indicating whether the API key shoud be read-only
    token String
    API token which can be used in Equinix Metal API clients

    Package Details

    Repository
    equinix equinix/pulumi-equinix
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the equinix Terraform Provider.
    equinix logo
    Equinix v0.10.0 published on Wednesday, May 22, 2024 by Equinix