1. Packages
  2. Scaleway
  3. API Docs
  4. CockpitToken
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.CockpitToken

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

    Creates and manages Scaleway Cockpit Tokens.

    For more information consult the documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainCockpit = scaleway.getCockpit({});
    // Create a token for the cockpit that can write metrics and logs
    const mainCockpitToken = new scaleway.CockpitToken("mainCockpitToken", {projectId: mainCockpit.then(mainCockpit => mainCockpit.projectId)});
    
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway
    
    main_cockpit = scaleway.get_cockpit()
    # Create a token for the cockpit that can write metrics and logs
    main_cockpit_token = scaleway.CockpitToken("mainCockpitToken", project_id=main_cockpit.project_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mainCockpit, err := scaleway.LookupCockpit(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		// Create a token for the cockpit that can write metrics and logs
    		_, err = scaleway.NewCockpitToken(ctx, "mainCockpitToken", &scaleway.CockpitTokenArgs{
    			ProjectId: pulumi.String(mainCockpit.ProjectId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var mainCockpit = Scaleway.GetCockpit.Invoke();
    
        // Create a token for the cockpit that can write metrics and logs
        var mainCockpitToken = new Scaleway.CockpitToken("mainCockpitToken", new()
        {
            ProjectId = mainCockpit.Apply(getCockpitResult => getCockpitResult.ProjectId),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.ScalewayFunctions;
    import com.pulumi.scaleway.inputs.GetCockpitArgs;
    import com.pulumi.scaleway.CockpitToken;
    import com.pulumi.scaleway.CockpitTokenArgs;
    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) {
            final var mainCockpit = ScalewayFunctions.getCockpit();
    
            // Create a token for the cockpit that can write metrics and logs
            var mainCockpitToken = new CockpitToken("mainCockpitToken", CockpitTokenArgs.builder()        
                .projectId(mainCockpit.applyValue(getCockpitResult -> getCockpitResult.projectId()))
                .build());
    
        }
    }
    
    resources:
      # Create a token for the cockpit that can write metrics and logs
      mainCockpitToken:
        type: scaleway:CockpitToken
        properties:
          projectId: ${mainCockpit.projectId}
    variables:
      mainCockpit:
        fn::invoke:
          Function: scaleway:getCockpit
          Arguments: {}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainCockpit = scaleway.getCockpit({});
    // Create a token for the cockpit that can read metrics and logs but not write
    const mainCockpitToken = new scaleway.CockpitToken("mainCockpitToken", {
        projectId: mainCockpit.then(mainCockpit => mainCockpit.projectId),
        scopes: {
            queryMetrics: true,
            writeMetrics: false,
            queryLogs: true,
            writeLogs: false,
        },
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway
    
    main_cockpit = scaleway.get_cockpit()
    # Create a token for the cockpit that can read metrics and logs but not write
    main_cockpit_token = scaleway.CockpitToken("mainCockpitToken",
        project_id=main_cockpit.project_id,
        scopes=scaleway.CockpitTokenScopesArgs(
            query_metrics=True,
            write_metrics=False,
            query_logs=True,
            write_logs=False,
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mainCockpit, err := scaleway.LookupCockpit(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		// Create a token for the cockpit that can read metrics and logs but not write
    		_, err = scaleway.NewCockpitToken(ctx, "mainCockpitToken", &scaleway.CockpitTokenArgs{
    			ProjectId: pulumi.String(mainCockpit.ProjectId),
    			Scopes: &scaleway.CockpitTokenScopesArgs{
    				QueryMetrics: pulumi.Bool(true),
    				WriteMetrics: pulumi.Bool(false),
    				QueryLogs:    pulumi.Bool(true),
    				WriteLogs:    pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var mainCockpit = Scaleway.GetCockpit.Invoke();
    
        // Create a token for the cockpit that can read metrics and logs but not write
        var mainCockpitToken = new Scaleway.CockpitToken("mainCockpitToken", new()
        {
            ProjectId = mainCockpit.Apply(getCockpitResult => getCockpitResult.ProjectId),
            Scopes = new Scaleway.Inputs.CockpitTokenScopesArgs
            {
                QueryMetrics = true,
                WriteMetrics = false,
                QueryLogs = true,
                WriteLogs = false,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.ScalewayFunctions;
    import com.pulumi.scaleway.inputs.GetCockpitArgs;
    import com.pulumi.scaleway.CockpitToken;
    import com.pulumi.scaleway.CockpitTokenArgs;
    import com.pulumi.scaleway.inputs.CockpitTokenScopesArgs;
    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) {
            final var mainCockpit = ScalewayFunctions.getCockpit();
    
            // Create a token for the cockpit that can read metrics and logs but not write
            var mainCockpitToken = new CockpitToken("mainCockpitToken", CockpitTokenArgs.builder()        
                .projectId(mainCockpit.applyValue(getCockpitResult -> getCockpitResult.projectId()))
                .scopes(CockpitTokenScopesArgs.builder()
                    .queryMetrics(true)
                    .writeMetrics(false)
                    .queryLogs(true)
                    .writeLogs(false)
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Create a token for the cockpit that can read metrics and logs but not write
      mainCockpitToken:
        type: scaleway:CockpitToken
        properties:
          projectId: ${mainCockpit.projectId}
          scopes:
            queryMetrics: true
            writeMetrics: false
            queryLogs: true
            writeLogs: false
    variables:
      mainCockpit:
        fn::invoke:
          Function: scaleway:getCockpit
          Arguments: {}
    

    Create CockpitToken Resource

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

    Constructor syntax

    new CockpitToken(name: string, args?: CockpitTokenArgs, opts?: CustomResourceOptions);
    @overload
    def CockpitToken(resource_name: str,
                     args: Optional[CockpitTokenArgs] = None,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def CockpitToken(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     name: Optional[str] = None,
                     project_id: Optional[str] = None,
                     scopes: Optional[CockpitTokenScopesArgs] = None)
    func NewCockpitToken(ctx *Context, name string, args *CockpitTokenArgs, opts ...ResourceOption) (*CockpitToken, error)
    public CockpitToken(string name, CockpitTokenArgs? args = null, CustomResourceOptions? opts = null)
    public CockpitToken(String name, CockpitTokenArgs args)
    public CockpitToken(String name, CockpitTokenArgs args, CustomResourceOptions options)
    
    type: scaleway:CockpitToken
    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 CockpitTokenArgs
    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 CockpitTokenArgs
    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 CockpitTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CockpitTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CockpitTokenArgs
    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 cockpitTokenResource = new Scaleway.CockpitToken("cockpitTokenResource", new()
    {
        Name = "string",
        ProjectId = "string",
        Scopes = new Scaleway.Inputs.CockpitTokenScopesArgs
        {
            QueryLogs = false,
            QueryMetrics = false,
            QueryTraces = false,
            SetupAlerts = false,
            SetupLogsRules = false,
            SetupMetricsRules = false,
            WriteLogs = false,
            WriteMetrics = false,
            WriteTraces = false,
        },
    });
    
    example, err := scaleway.NewCockpitToken(ctx, "cockpitTokenResource", &scaleway.CockpitTokenArgs{
    	Name:      pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Scopes: &scaleway.CockpitTokenScopesArgs{
    		QueryLogs:         pulumi.Bool(false),
    		QueryMetrics:      pulumi.Bool(false),
    		QueryTraces:       pulumi.Bool(false),
    		SetupAlerts:       pulumi.Bool(false),
    		SetupLogsRules:    pulumi.Bool(false),
    		SetupMetricsRules: pulumi.Bool(false),
    		WriteLogs:         pulumi.Bool(false),
    		WriteMetrics:      pulumi.Bool(false),
    		WriteTraces:       pulumi.Bool(false),
    	},
    })
    
    var cockpitTokenResource = new CockpitToken("cockpitTokenResource", CockpitTokenArgs.builder()        
        .name("string")
        .projectId("string")
        .scopes(CockpitTokenScopesArgs.builder()
            .queryLogs(false)
            .queryMetrics(false)
            .queryTraces(false)
            .setupAlerts(false)
            .setupLogsRules(false)
            .setupMetricsRules(false)
            .writeLogs(false)
            .writeMetrics(false)
            .writeTraces(false)
            .build())
        .build());
    
    cockpit_token_resource = scaleway.CockpitToken("cockpitTokenResource",
        name="string",
        project_id="string",
        scopes=scaleway.CockpitTokenScopesArgs(
            query_logs=False,
            query_metrics=False,
            query_traces=False,
            setup_alerts=False,
            setup_logs_rules=False,
            setup_metrics_rules=False,
            write_logs=False,
            write_metrics=False,
            write_traces=False,
        ))
    
    const cockpitTokenResource = new scaleway.CockpitToken("cockpitTokenResource", {
        name: "string",
        projectId: "string",
        scopes: {
            queryLogs: false,
            queryMetrics: false,
            queryTraces: false,
            setupAlerts: false,
            setupLogsRules: false,
            setupMetricsRules: false,
            writeLogs: false,
            writeMetrics: false,
            writeTraces: false,
        },
    });
    
    type: scaleway:CockpitToken
    properties:
        name: string
        projectId: string
        scopes:
            queryLogs: false
            queryMetrics: false
            queryTraces: false
            setupAlerts: false
            setupLogsRules: false
            setupMetricsRules: false
            writeLogs: false
            writeMetrics: false
            writeTraces: false
    

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

    Name string
    The name of the token.
    ProjectId string
    project_id) The ID of the project the cockpit is associated with.
    Scopes Pulumiverse.Scaleway.Inputs.CockpitTokenScopes
    Allowed scopes.
    Name string
    The name of the token.
    ProjectId string
    project_id) The ID of the project the cockpit is associated with.
    Scopes CockpitTokenScopesArgs
    Allowed scopes.
    name String
    The name of the token.
    projectId String
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopes
    Allowed scopes.
    name string
    The name of the token.
    projectId string
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopes
    Allowed scopes.
    name str
    The name of the token.
    project_id str
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopesArgs
    Allowed scopes.
    name String
    The name of the token.
    projectId String
    project_id) The ID of the project the cockpit is associated with.
    scopes Property Map
    Allowed scopes.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    SecretKey string
    The secret key of the token.
    Id string
    The provider-assigned unique ID for this managed resource.
    SecretKey string
    The secret key of the token.
    id String
    The provider-assigned unique ID for this managed resource.
    secretKey String
    The secret key of the token.
    id string
    The provider-assigned unique ID for this managed resource.
    secretKey string
    The secret key of the token.
    id str
    The provider-assigned unique ID for this managed resource.
    secret_key str
    The secret key of the token.
    id String
    The provider-assigned unique ID for this managed resource.
    secretKey String
    The secret key of the token.

    Look up Existing CockpitToken Resource

    Get an existing CockpitToken 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?: CockpitTokenState, opts?: CustomResourceOptions): CockpitToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            scopes: Optional[CockpitTokenScopesArgs] = None,
            secret_key: Optional[str] = None) -> CockpitToken
    func GetCockpitToken(ctx *Context, name string, id IDInput, state *CockpitTokenState, opts ...ResourceOption) (*CockpitToken, error)
    public static CockpitToken Get(string name, Input<string> id, CockpitTokenState? state, CustomResourceOptions? opts = null)
    public static CockpitToken get(String name, Output<String> id, CockpitTokenState 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:
    Name string
    The name of the token.
    ProjectId string
    project_id) The ID of the project the cockpit is associated with.
    Scopes Pulumiverse.Scaleway.Inputs.CockpitTokenScopes
    Allowed scopes.
    SecretKey string
    The secret key of the token.
    Name string
    The name of the token.
    ProjectId string
    project_id) The ID of the project the cockpit is associated with.
    Scopes CockpitTokenScopesArgs
    Allowed scopes.
    SecretKey string
    The secret key of the token.
    name String
    The name of the token.
    projectId String
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopes
    Allowed scopes.
    secretKey String
    The secret key of the token.
    name string
    The name of the token.
    projectId string
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopes
    Allowed scopes.
    secretKey string
    The secret key of the token.
    name str
    The name of the token.
    project_id str
    project_id) The ID of the project the cockpit is associated with.
    scopes CockpitTokenScopesArgs
    Allowed scopes.
    secret_key str
    The secret key of the token.
    name String
    The name of the token.
    projectId String
    project_id) The ID of the project the cockpit is associated with.
    scopes Property Map
    Allowed scopes.
    secretKey String
    The secret key of the token.

    Supporting Types

    CockpitTokenScopes, CockpitTokenScopesArgs

    QueryLogs bool
    Query logs.
    QueryMetrics bool
    Query metrics.
    QueryTraces bool
    Query traces.
    SetupAlerts bool
    Setup alerts.
    SetupLogsRules bool
    Setup logs rules.
    SetupMetricsRules bool
    Setup metrics rules.
    WriteLogs bool
    Write logs.
    WriteMetrics bool
    Write metrics.
    WriteTraces bool
    Write traces.
    QueryLogs bool
    Query logs.
    QueryMetrics bool
    Query metrics.
    QueryTraces bool
    Query traces.
    SetupAlerts bool
    Setup alerts.
    SetupLogsRules bool
    Setup logs rules.
    SetupMetricsRules bool
    Setup metrics rules.
    WriteLogs bool
    Write logs.
    WriteMetrics bool
    Write metrics.
    WriteTraces bool
    Write traces.
    queryLogs Boolean
    Query logs.
    queryMetrics Boolean
    Query metrics.
    queryTraces Boolean
    Query traces.
    setupAlerts Boolean
    Setup alerts.
    setupLogsRules Boolean
    Setup logs rules.
    setupMetricsRules Boolean
    Setup metrics rules.
    writeLogs Boolean
    Write logs.
    writeMetrics Boolean
    Write metrics.
    writeTraces Boolean
    Write traces.
    queryLogs boolean
    Query logs.
    queryMetrics boolean
    Query metrics.
    queryTraces boolean
    Query traces.
    setupAlerts boolean
    Setup alerts.
    setupLogsRules boolean
    Setup logs rules.
    setupMetricsRules boolean
    Setup metrics rules.
    writeLogs boolean
    Write logs.
    writeMetrics boolean
    Write metrics.
    writeTraces boolean
    Write traces.
    query_logs bool
    Query logs.
    query_metrics bool
    Query metrics.
    query_traces bool
    Query traces.
    setup_alerts bool
    Setup alerts.
    setup_logs_rules bool
    Setup logs rules.
    setup_metrics_rules bool
    Setup metrics rules.
    write_logs bool
    Write logs.
    write_metrics bool
    Write metrics.
    write_traces bool
    Write traces.
    queryLogs Boolean
    Query logs.
    queryMetrics Boolean
    Query metrics.
    queryTraces Boolean
    Query traces.
    setupAlerts Boolean
    Setup alerts.
    setupLogsRules Boolean
    Setup logs rules.
    setupMetricsRules Boolean
    Setup metrics rules.
    writeLogs Boolean
    Write logs.
    writeMetrics Boolean
    Write metrics.
    writeTraces Boolean
    Write traces.

    Import

    Cockpits can be imported using the token ID, e.g.

    bash

    $ pulumi import scaleway:index/cockpitToken:CockpitToken main 11111111-1111-1111-1111-111111111111
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse