1. Packages
  2. Platform Provider
  3. API Docs
  4. WorkersService
platform 2.2.1 published on Friday, Mar 7, 2025 by jfrog

platform.WorkersService

Explore with Pulumi AI

Provides a JFrog Workers Service resource. This can be used to create and manage Workers Service.

->From Artifactory 7.94 the Workers service will be available in a general availability release to Enterprise X and Enterprise+ licenses.

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.platform.WorkersService;
import com.pulumi.platform.WorkersServiceArgs;
import com.pulumi.platform.inputs.WorkersServiceFilterCriteriaArgs;
import com.pulumi.platform.inputs.WorkersServiceSecretArgs;
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 my_workers_service = new WorkersService("my-workers-service", WorkersServiceArgs.builder()
            .action("BEFORE_DOWNLOAD")
            .description("My workers service")
            .enabled(true)
            .filterCriteria(WorkersServiceFilterCriteriaArgs.builder()
                .artifact_filter_criteria(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
                .build())
            .key("my-workers-service")
            .secrets(            
                WorkersServiceSecretArgs.builder()
                    .key("my-secret-key-1")
                    .value("my-secret-value-1")
                    .build(),
                WorkersServiceSecretArgs.builder()
                    .key("my-secret-key-2")
                    .value("my-secret-value-2")
                    .build())
            .sourceCode("""
export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => {
  console.log(await context.clients.platformHttp.get('/artifactory/api/system/ping'));
  console.log(await axios.get('https://my.external.resource'));
  return {
    status: 'DOWNLOAD_PROCEED',
    message: 'proceed',
  }
}

            """)
            .build());

    }
}
Copy
resources:
  my-workers-service:
    type: platform:WorkersService
    properties:
      action: BEFORE_DOWNLOAD
      description: My workers service
      enabled: true
      filterCriteria:
        artifact_filter_criteria:
          repoKeys:
            - my-repo-key
      key: my-workers-service
      secrets:
        - key: my-secret-key-1
          value: my-secret-value-1
        - key: my-secret-key-2
          value: my-secret-value-2
      sourceCode: |+
        export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => {
          console.log(await context.clients.platformHttp.get('/artifactory/api/system/ping'));
          console.log(await axios.get('https://my.external.resource'));
          return {
            status: 'DOWNLOAD_PROCEED',
            message: 'proceed',
          }
        }        
Copy

Create WorkersService Resource

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

Constructor syntax

new WorkersService(name: string, args: WorkersServiceArgs, opts?: CustomResourceOptions);
@overload
def WorkersService(resource_name: str,
                   args: WorkersServiceArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def WorkersService(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   action: Optional[str] = None,
                   enabled: Optional[bool] = None,
                   filter_criteria: Optional[WorkersServiceFilterCriteriaArgs] = None,
                   key: Optional[str] = None,
                   source_code: Optional[str] = None,
                   description: Optional[str] = None,
                   secrets: Optional[Sequence[WorkersServiceSecretArgs]] = None)
func NewWorkersService(ctx *Context, name string, args WorkersServiceArgs, opts ...ResourceOption) (*WorkersService, error)
public WorkersService(string name, WorkersServiceArgs args, CustomResourceOptions? opts = null)
public WorkersService(String name, WorkersServiceArgs args)
public WorkersService(String name, WorkersServiceArgs args, CustomResourceOptions options)
type: platform:WorkersService
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WorkersServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WorkersServiceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersServiceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkersServiceArgs
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 workersServiceResource = new Platform.WorkersService("workersServiceResource", new()
{
    Action = "string",
    Enabled = false,
    FilterCriteria = new Platform.Inputs.WorkersServiceFilterCriteriaArgs
    {
        ArtifactFilterCriteria = new Platform.Inputs.WorkersServiceFilterCriteriaArtifactFilterCriteriaArgs
        {
            RepoKeys = new[]
            {
                "string",
            },
            ExcludePatterns = new[]
            {
                "string",
            },
            IncludePatterns = new[]
            {
                "string",
            },
        },
    },
    Key = "string",
    SourceCode = "string",
    Description = "string",
    Secrets = new[]
    {
        new Platform.Inputs.WorkersServiceSecretArgs
        {
            Key = "string",
            Value = "string",
        },
    },
});
Copy
example, err := platform.NewWorkersService(ctx, "workersServiceResource", &platform.WorkersServiceArgs{
Action: pulumi.String("string"),
Enabled: pulumi.Bool(false),
FilterCriteria: &.WorkersServiceFilterCriteriaArgs{
ArtifactFilterCriteria: &.WorkersServiceFilterCriteriaArtifactFilterCriteriaArgs{
RepoKeys: pulumi.StringArray{
pulumi.String("string"),
},
ExcludePatterns: pulumi.StringArray{
pulumi.String("string"),
},
IncludePatterns: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Key: pulumi.String("string"),
SourceCode: pulumi.String("string"),
Description: pulumi.String("string"),
Secrets: .WorkersServiceSecretArray{
&.WorkersServiceSecretArgs{
Key: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
})
Copy
var workersServiceResource = new WorkersService("workersServiceResource", WorkersServiceArgs.builder()
    .action("string")
    .enabled(false)
    .filterCriteria(WorkersServiceFilterCriteriaArgs.builder()
        .artifactFilterCriteria(WorkersServiceFilterCriteriaArtifactFilterCriteriaArgs.builder()
            .repoKeys("string")
            .excludePatterns("string")
            .includePatterns("string")
            .build())
        .build())
    .key("string")
    .sourceCode("string")
    .description("string")
    .secrets(WorkersServiceSecretArgs.builder()
        .key("string")
        .value("string")
        .build())
    .build());
Copy
workers_service_resource = platform.WorkersService("workersServiceResource",
    action="string",
    enabled=False,
    filter_criteria={
        "artifact_filter_criteria": {
            "repo_keys": ["string"],
            "exclude_patterns": ["string"],
            "include_patterns": ["string"],
        },
    },
    key="string",
    source_code="string",
    description="string",
    secrets=[{
        "key": "string",
        "value": "string",
    }])
Copy
const workersServiceResource = new platform.WorkersService("workersServiceResource", {
    action: "string",
    enabled: false,
    filterCriteria: {
        artifactFilterCriteria: {
            repoKeys: ["string"],
            excludePatterns: ["string"],
            includePatterns: ["string"],
        },
    },
    key: "string",
    sourceCode: "string",
    description: "string",
    secrets: [{
        key: "string",
        value: "string",
    }],
});
Copy
type: platform:WorkersService
properties:
    action: string
    description: string
    enabled: false
    filterCriteria:
        artifactFilterCriteria:
            excludePatterns:
                - string
            includePatterns:
                - string
            repoKeys:
                - string
    key: string
    secrets:
        - key: string
          value: string
    sourceCode: string
Copy

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

Action This property is required. string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
Enabled This property is required. bool
Whether to enable the worker immediately after creation.
FilterCriteria This property is required. WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
Key This property is required. string
The unique ID of the worker.
SourceCode This property is required. string
The worker script in TypeScript or JavaScript.
Description string
Description of the worker.
Secrets List<WorkersServiceSecret>
The secrets to be added to the worker.
Action This property is required. string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
Enabled This property is required. bool
Whether to enable the worker immediately after creation.
FilterCriteria This property is required. WorkersServiceFilterCriteriaArgs
Defines the repositories to be used or excluded.
Key This property is required. string
The unique ID of the worker.
SourceCode This property is required. string
The worker script in TypeScript or JavaScript.
Description string
Description of the worker.
Secrets []WorkersServiceSecretArgs
The secrets to be added to the worker.
action This property is required. String
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
enabled This property is required. Boolean
Whether to enable the worker immediately after creation.
filterCriteria This property is required. WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
key This property is required. String
The unique ID of the worker.
sourceCode This property is required. String
The worker script in TypeScript or JavaScript.
description String
Description of the worker.
secrets List<WorkersServiceSecret>
The secrets to be added to the worker.
action This property is required. string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
enabled This property is required. boolean
Whether to enable the worker immediately after creation.
filterCriteria This property is required. WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
key This property is required. string
The unique ID of the worker.
sourceCode This property is required. string
The worker script in TypeScript or JavaScript.
description string
Description of the worker.
secrets WorkersServiceSecret[]
The secrets to be added to the worker.
action This property is required. str
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
enabled This property is required. bool
Whether to enable the worker immediately after creation.
filter_criteria This property is required. WorkersServiceFilterCriteriaArgs
Defines the repositories to be used or excluded.
key This property is required. str
The unique ID of the worker.
source_code This property is required. str
The worker script in TypeScript or JavaScript.
description str
Description of the worker.
secrets Sequence[WorkersServiceSecretArgs]
The secrets to be added to the worker.
action This property is required. String
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
enabled This property is required. Boolean
Whether to enable the worker immediately after creation.
filterCriteria This property is required. Property Map
Defines the repositories to be used or excluded.
key This property is required. String
The unique ID of the worker.
sourceCode This property is required. String
The worker script in TypeScript or JavaScript.
description String
Description of the worker.
secrets List<Property Map>
The secrets to be added to the worker.

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkersService 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 WorkersService Resource

Get an existing WorkersService 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?: WorkersServiceState, opts?: CustomResourceOptions): WorkersService
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        action: Optional[str] = None,
        description: Optional[str] = None,
        enabled: Optional[bool] = None,
        filter_criteria: Optional[WorkersServiceFilterCriteriaArgs] = None,
        key: Optional[str] = None,
        secrets: Optional[Sequence[WorkersServiceSecretArgs]] = None,
        source_code: Optional[str] = None) -> WorkersService
func GetWorkersService(ctx *Context, name string, id IDInput, state *WorkersServiceState, opts ...ResourceOption) (*WorkersService, error)
public static WorkersService Get(string name, Input<string> id, WorkersServiceState? state, CustomResourceOptions? opts = null)
public static WorkersService get(String name, Output<String> id, WorkersServiceState state, CustomResourceOptions options)
resources:  _:    type: platform:WorkersService    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Action string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
Description string
Description of the worker.
Enabled bool
Whether to enable the worker immediately after creation.
FilterCriteria WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
Key string
The unique ID of the worker.
Secrets List<WorkersServiceSecret>
The secrets to be added to the worker.
SourceCode string
The worker script in TypeScript or JavaScript.
Action string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
Description string
Description of the worker.
Enabled bool
Whether to enable the worker immediately after creation.
FilterCriteria WorkersServiceFilterCriteriaArgs
Defines the repositories to be used or excluded.
Key string
The unique ID of the worker.
Secrets []WorkersServiceSecretArgs
The secrets to be added to the worker.
SourceCode string
The worker script in TypeScript or JavaScript.
action String
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
description String
Description of the worker.
enabled Boolean
Whether to enable the worker immediately after creation.
filterCriteria WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
key String
The unique ID of the worker.
secrets List<WorkersServiceSecret>
The secrets to be added to the worker.
sourceCode String
The worker script in TypeScript or JavaScript.
action string
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
description string
Description of the worker.
enabled boolean
Whether to enable the worker immediately after creation.
filterCriteria WorkersServiceFilterCriteria
Defines the repositories to be used or excluded.
key string
The unique ID of the worker.
secrets WorkersServiceSecret[]
The secrets to be added to the worker.
sourceCode string
The worker script in TypeScript or JavaScript.
action str
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
description str
Description of the worker.
enabled bool
Whether to enable the worker immediately after creation.
filter_criteria WorkersServiceFilterCriteriaArgs
Defines the repositories to be used or excluded.
key str
The unique ID of the worker.
secrets Sequence[WorkersServiceSecretArgs]
The secrets to be added to the worker.
source_code str
The worker script in TypeScript or JavaScript.
action String
The worker action with which the worker is associated. Valid values: BEFOREDOWNLOAD, AFTERDOWNLOAD, BEFOREUPLOAD, AFTERCREATE, AFTERBUILDINFOSAVE, AFTERMOVE
description String
Description of the worker.
enabled Boolean
Whether to enable the worker immediately after creation.
filterCriteria Property Map
Defines the repositories to be used or excluded.
key String
The unique ID of the worker.
secrets List<Property Map>
The secrets to be added to the worker.
sourceCode String
The worker script in TypeScript or JavaScript.

Supporting Types

WorkersServiceFilterCriteria
, WorkersServiceFilterCriteriaArgs

artifactFilterCriteria This property is required. Property Map

WorkersServiceFilterCriteriaArtifactFilterCriteria
, WorkersServiceFilterCriteriaArtifactFilterCriteriaArgs

RepoKeys This property is required. List<string>
Defines which repositories are used when an action event occurs to trigger the worker.
ExcludePatterns List<string>
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
IncludePatterns List<string>
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.
RepoKeys This property is required. []string
Defines which repositories are used when an action event occurs to trigger the worker.
ExcludePatterns []string
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
IncludePatterns []string
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.
repoKeys This property is required. List<String>
Defines which repositories are used when an action event occurs to trigger the worker.
excludePatterns List<String>
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
includePatterns List<String>
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.
repoKeys This property is required. string[]
Defines which repositories are used when an action event occurs to trigger the worker.
excludePatterns string[]
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
includePatterns string[]
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.
repo_keys This property is required. Sequence[str]
Defines which repositories are used when an action event occurs to trigger the worker.
exclude_patterns Sequence[str]
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
include_patterns Sequence[str]
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.
repoKeys This property is required. List<String>
Defines which repositories are used when an action event occurs to trigger the worker.
excludePatterns List<String>
Define patterns to for all repository paths for repositories to be excluded in the repoKeys. Defines those repositories that do not trigger the worker.
includePatterns List<String>
Define patterns to match all repository paths for repositories identified in the repoKeys. Defines those repositories that trigger the worker.

WorkersServiceSecret
, WorkersServiceSecretArgs

Key This property is required. string
The name of the secret.
Value This property is required. string
The name of the secret.
Key This property is required. string
The name of the secret.
Value This property is required. string
The name of the secret.
key This property is required. String
The name of the secret.
value This property is required. String
The name of the secret.
key This property is required. string
The name of the secret.
value This property is required. string
The name of the secret.
key This property is required. str
The name of the secret.
value This property is required. str
The name of the secret.
key This property is required. String
The name of the secret.
value This property is required. String
The name of the secret.

Import

$ pulumi import platform:index/workersService:WorkersService my-worker-service my-worker-service-key
Copy

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

Package Details

Repository
platform jfrog/terraform-provider-platform
License
Notes
This Pulumi package is based on the platform Terraform Provider.