1. Packages
  2. Nexus Provider
  3. API Docs
  4. Script
nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers

nexus.Script

Explore with Pulumi AI

nexus logo
nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers

    Use this resource to create and execute a custom script.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nexus from "@pulumi/nexus";
    
    const repoPypiInternal = new nexus.Script("repoPypiInternal", {
        content: "repository.createPyPiHosted('pypi-internal')",
        type: "groovy",
    });
    
    import pulumi
    import pulumi_nexus as nexus
    
    repo_pypi_internal = nexus.Script("repoPypiInternal",
        content="repository.createPyPiHosted('pypi-internal')",
        type="groovy")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nexus/v2/nexus"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nexus.NewScript(ctx, "repoPypiInternal", &nexus.ScriptArgs{
    			Content: pulumi.String("repository.createPyPiHosted('pypi-internal')"),
    			Type:    pulumi.String("groovy"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nexus = Pulumi.Nexus;
    
    return await Deployment.RunAsync(() => 
    {
        var repoPypiInternal = new Nexus.Script("repoPypiInternal", new()
        {
            Content = "repository.createPyPiHosted('pypi-internal')",
            Type = "groovy",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nexus.Script;
    import com.pulumi.nexus.ScriptArgs;
    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 repoPypiInternal = new Script("repoPypiInternal", ScriptArgs.builder()
                .content("repository.createPyPiHosted('pypi-internal')")
                .type("groovy")
                .build());
    
        }
    }
    
    resources:
      repoPypiInternal:
        type: nexus:Script
        properties:
          content: repository.createPyPiHosted('pypi-internal')
          type: groovy
    

    Create Script Resource

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

    Constructor syntax

    new Script(name: string, args: ScriptArgs, opts?: CustomResourceOptions);
    @overload
    def Script(resource_name: str,
               args: ScriptArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Script(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               content: Optional[str] = None,
               name: Optional[str] = None,
               type: Optional[str] = None)
    func NewScript(ctx *Context, name string, args ScriptArgs, opts ...ResourceOption) (*Script, error)
    public Script(string name, ScriptArgs args, CustomResourceOptions? opts = null)
    public Script(String name, ScriptArgs args)
    public Script(String name, ScriptArgs args, CustomResourceOptions options)
    
    type: nexus:Script
    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 ScriptArgs
    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 ScriptArgs
    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 ScriptArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ScriptArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ScriptArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var scriptResource = new Nexus.Script("scriptResource", new()
    {
        Content = "string",
        Name = "string",
        Type = "string",
    });
    
    example, err := nexus.NewScript(ctx, "scriptResource", &nexus.ScriptArgs{
    	Content: pulumi.String("string"),
    	Name:    pulumi.String("string"),
    	Type:    pulumi.String("string"),
    })
    
    var scriptResource = new Script("scriptResource", ScriptArgs.builder()
        .content("string")
        .name("string")
        .type("string")
        .build());
    
    script_resource = nexus.Script("scriptResource",
        content="string",
        name="string",
        type="string")
    
    const scriptResource = new nexus.Script("scriptResource", {
        content: "string",
        name: "string",
        type: "string",
    });
    
    type: nexus:Script
    properties:
        content: string
        name: string
        type: string
    

    Script Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Script resource accepts the following input properties:

    Content string
    The content of this script.
    Name string
    The name of the script.
    Type string
    The type of the script. Default: groovy
    Content string
    The content of this script.
    Name string
    The name of the script.
    Type string
    The type of the script. Default: groovy
    content String
    The content of this script.
    name String
    The name of the script.
    type String
    The type of the script. Default: groovy
    content string
    The content of this script.
    name string
    The name of the script.
    type string
    The type of the script. Default: groovy
    content str
    The content of this script.
    name str
    The name of the script.
    type str
    The type of the script. Default: groovy
    content String
    The content of this script.
    name String
    The name of the script.
    type String
    The type of the script. Default: groovy

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Script Resource

    Get an existing Script 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?: ScriptState, opts?: CustomResourceOptions): Script
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content: Optional[str] = None,
            name: Optional[str] = None,
            type: Optional[str] = None) -> Script
    func GetScript(ctx *Context, name string, id IDInput, state *ScriptState, opts ...ResourceOption) (*Script, error)
    public static Script Get(string name, Input<string> id, ScriptState? state, CustomResourceOptions? opts = null)
    public static Script get(String name, Output<String> id, ScriptState state, CustomResourceOptions options)
    resources:  _:    type: nexus:Script    get:      id: ${id}
    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:
    Content string
    The content of this script.
    Name string
    The name of the script.
    Type string
    The type of the script. Default: groovy
    Content string
    The content of this script.
    Name string
    The name of the script.
    Type string
    The type of the script. Default: groovy
    content String
    The content of this script.
    name String
    The name of the script.
    type String
    The type of the script. Default: groovy
    content string
    The content of this script.
    name string
    The name of the script.
    type string
    The type of the script. Default: groovy
    content str
    The content of this script.
    name str
    The name of the script.
    type str
    The type of the script. Default: groovy
    content String
    The content of this script.
    name String
    The name of the script.
    type String
    The type of the script. Default: groovy

    Import

    import using the name of script

    $ pulumi import nexus:index/script:Script repo_pypi_internal create-repo-pypi-internal
    

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

    Package Details

    Repository
    nexus datadrivers/terraform-provider-nexus
    License
    Notes
    This Pulumi package is based on the nexus Terraform Provider.
    nexus logo
    nexus 2.5.0 published on Monday, Apr 14, 2025 by datadrivers