Skip to content

Commit

Permalink
feat(serverless_jobs): enable secrets (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Nov 5, 2024
1 parent 6b3485c commit c7ba13c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
29 changes: 29 additions & 0 deletions packages/clients/src/api/jobs/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ export class API extends ParentAPI {
unmarshalStartJobDefinitionResponse,
)

/**
* Create a secret reference within a job definition.
*
* @param request - The request {@link CreateJobDefinitionSecretsRequest}
* @returns A Promise of CreateJobDefinitionSecretsResponse
*/
createJobDefinitionSecrets = (
request: Readonly<CreateJobDefinitionSecretsRequest>,
) =>
Expand All @@ -203,6 +209,12 @@ export class API extends ParentAPI {
unmarshalCreateJobDefinitionSecretsResponse,
)

/**
* Get a secret references within a job definition.
*
* @param request - The request {@link GetJobDefinitionSecretRequest}
* @returns A Promise of Secret
*/
getJobDefinitionSecret = (request: Readonly<GetJobDefinitionSecretRequest>) =>
this.client.fetch<Secret>(
{
Expand All @@ -212,6 +224,12 @@ export class API extends ParentAPI {
unmarshalSecret,
)

/**
* List secrets references within a job definition.
*
* @param request - The request {@link ListJobDefinitionSecretsRequest}
* @returns A Promise of ListJobDefinitionSecretsResponse
*/
listJobDefinitionSecrets = (
request: Readonly<ListJobDefinitionSecretsRequest>,
) =>
Expand All @@ -223,6 +241,12 @@ export class API extends ParentAPI {
unmarshalListJobDefinitionSecretsResponse,
)

/**
* Update a secret reference within a job definition.
*
* @param request - The request {@link UpdateJobDefinitionSecretRequest}
* @returns A Promise of Secret
*/
updateJobDefinitionSecret = (
request: Readonly<UpdateJobDefinitionSecretRequest>,
) =>
Expand All @@ -241,6 +265,11 @@ export class API extends ParentAPI {
unmarshalSecret,
)

/**
* Delete a secret reference within a job definition.
*
* @param request - The request {@link DeleteJobDefinitionSecretRequest}
*/
deleteJobDefinitionSecret = (
request: Readonly<DeleteJobDefinitionSecretRequest>,
) =>
Expand Down
44 changes: 38 additions & 6 deletions packages/clients/src/api/jobs/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,23 @@ export interface CreateJobDefinitionSecretsRequestSecretConfig {
}

export interface Secret {
/** UUID of the secret reference within the job. */
secretId: string
/** UUID of the secret in Secret Manager. */
secretManagerId: string
/** Version of the secret in Secret Manager. */
secretManagerVersion: string
/** One-of ('secretConfig'): at most one of 'file', 'envVar' could be set. */
/**
* File secret mounted inside the job.
*
* One-of ('secretConfig'): at most one of 'file', 'envVar' could be set.
*/
file?: SecretFile
/** One-of ('secretConfig'): at most one of 'file', 'envVar' could be set. */
/**
* Environment variable used to expose the secret.
*
* One-of ('secretConfig'): at most one of 'file', 'envVar' could be set.
*/
envVar?: SecretEnvVar
}

Expand Down Expand Up @@ -154,13 +165,14 @@ export type CreateJobDefinitionSecretsRequest = {
* config.
*/
region?: Region
/** UUID of the job definition to get. */
/** UUID of the job definition. */
jobDefinitionId: string
/** Secrets to inject into the job. */
/** List of secrets to inject into the job. */
secrets: CreateJobDefinitionSecretsRequestSecretConfig[]
}

export interface CreateJobDefinitionSecretsResponse {
/** List of secrets created. */
secrets: Secret[]
}

Expand All @@ -180,7 +192,9 @@ export type DeleteJobDefinitionSecretRequest = {
* config.
*/
region?: Region
/** UUID of the job definition. */
jobDefinitionId: string
/** UUID of the secret reference within the job. */
secretId: string
}

Expand All @@ -200,7 +214,9 @@ export type GetJobDefinitionSecretRequest = {
* config.
*/
region?: Region
/** UUID of the job definition. */
jobDefinitionId: string
/** UUID of the secret reference within the job. */
secretId: string
}

Expand Down Expand Up @@ -232,11 +248,14 @@ export type ListJobDefinitionSecretsRequest = {
* config.
*/
region?: Region
/** UUID of the job definition. */
jobDefinitionId: string
}

export interface ListJobDefinitionSecretsResponse {
/** List of secret references within a job definition. */
secrets: Secret[]
/** Total count of secret references within a job definition. */
totalCount: number
}

Expand Down Expand Up @@ -354,11 +373,24 @@ export type UpdateJobDefinitionSecretRequest = {
* config.
*/
region?: Region
/** UUID of the job definition. */
jobDefinitionId: string
/** UUID of the secret reference within the job. */
secretId: string
/** Version of the secret in Secret Manager. */
secretManagerVersion?: string
/** One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set. */
/**
* Path of the secret to mount inside the job (either `path` or `env_var_name`
* must be set).
*
* One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set.
*/
path?: string
/** One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set. */
/**
* Environment variable name used to expose the secret inside the job (either
* `path` or `env_var_name` must be set).
*
* One-of ('secretConfig'): at most one of 'path', 'envVarName' could be set.
*/
envVarName?: string
}

0 comments on commit c7ba13c

Please sign in to comment.