From 69c0ded96703d806f51e5b22b8489c12ded4d8e1 Mon Sep 17 00:00:00 2001 From: Huw Wilkins Date: Fri, 5 Jan 2024 15:07:43 +1100 Subject: [PATCH 1/2] Update facades for Juju 3.3. --- .gitignore | 1 + README.md | 14 +- api/client.ts | 6 +- api/facades/application/ApplicationV19.ts | 1125 +++++++ api/facades/application/index.ts | 3 + api/facades/charms/CharmsV7.ts | 470 +++ api/facades/charms/index.ts | 4 +- api/facades/client/ClientV7.ts | 466 +++ api/facades/client/index.ts | 4 +- .../migration-target/MigrationTargetV3.ts | 281 ++ api/facades/migration-target/index.ts | 4 +- api/facades/secrets/SecretsV2.ts | 281 ++ api/facades/secrets/index.ts | 4 +- api/facades/uniter/UniterV19.ts | 2693 +++++++++++++++++ api/facades/uniter/index.ts | 4 +- .../user-secrets-drain/UserSecretsDrainV1.ts | 274 ++ api/facades/user-secrets-drain/index.ts | 11 + .../UserSecretsManagerV1.ts | 105 + api/facades/user-secrets-manager/index.ts | 11 + generator/schema/juju-git-sha.txt | 2 +- generator/schema/juju-version.txt | 2 +- generator/schema/schema.json | 1751 ++++++++++- package.json | 4 +- 23 files changed, 7396 insertions(+), 124 deletions(-) create mode 100644 api/facades/application/ApplicationV19.ts create mode 100644 api/facades/charms/CharmsV7.ts create mode 100644 api/facades/client/ClientV7.ts create mode 100644 api/facades/migration-target/MigrationTargetV3.ts create mode 100644 api/facades/secrets/SecretsV2.ts create mode 100644 api/facades/uniter/UniterV19.ts create mode 100644 api/facades/user-secrets-drain/UserSecretsDrainV1.ts create mode 100644 api/facades/user-secrets-drain/index.ts create mode 100644 api/facades/user-secrets-manager/UserSecretsManagerV1.ts create mode 100644 api/facades/user-secrets-manager/index.ts diff --git a/.gitignore b/.gitignore index 2cd7e8cde..f926361f4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ api/!(test)**/*.js dist/ .nyc_output/ docs +.nfs.* \ No newline at end of file diff --git a/README.md b/README.md index 9b13d1ba8..8585a8260 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Detailed Facade documentation is available as part of the [full API documentatio | Annotations | | | ApplicationOffers | | | ApplicationScaler | | -| Application | | +| Application | | | Backups | | | Block | | | Bundle | | @@ -132,9 +132,9 @@ Detailed Facade documentation is available as part of the [full API documentatio | CharmDownloader | | | CharmHub | | | CharmRevisionUpdater | | -| Charms | | +| Charms | | | Cleaner | | -| Client | | +| Client | | | Cloud | | | Controller | | | CredentialManager | | @@ -176,7 +176,7 @@ Detailed Facade documentation is available as part of the [full API documentatio | MigrationMaster | | | MigrationMinion | | | MigrationStatusWatcher | | -| MigrationTarget | | +| MigrationTarget | | | ModelConfig | | | ModelGeneration | | | ModelManager | | @@ -207,7 +207,7 @@ Detailed Facade documentation is available as part of the [full API documentatio | SecretsRevisionWatcher | | | SecretsRotationWatcher | | | SecretsTriggerWatcher | | -| Secrets | | +| Secrets | | | Singular | | | Spaces | | | SSHClient | | @@ -218,11 +218,13 @@ Detailed Facade documentation is available as part of the [full API documentatio | Subnets | | | Undertaker | | | UnitAssigner | | -| Uniter | | +| Uniter | | | UpgradeSeries | | | UpgradeSteps | | | Upgrader | | | UserManager | | +| UserSecretsDrain | | +| UserSecretsManager | | | VolumeAttachmentPlansWatcher | | | VolumeAttachmentsWatcher | | diff --git a/api/client.ts b/api/client.ts index 1d0d93805..9bf16a286 100644 --- a/api/client.ts +++ b/api/client.ts @@ -30,7 +30,7 @@ import { } from "./types.js"; import { createAsyncHandler } from "./utils.js"; -export const CLIENT_VERSION = "3.2.1"; +export const CLIENT_VERSION = "3.3.2"; export interface ConnectOptions { bakery?: Bakery | null; @@ -271,7 +271,7 @@ class Client { "user-data": "", }; const url = this._transport._ws.url; - const origin = new URL(url).origin; + const origin = url; if (credentials.username && credentials.password) { args.credentials = credentials.password; @@ -540,7 +540,7 @@ class Connection { const clientRequestedFacades = facades.reduce( (facadeVersions: { [k: string]: FacadeClassList }, current) => { if ("versions" in current) { - // generic facade, where we won't the best version + // generic facade, where we want the best version if (!facadeVersions[current.name]) facadeVersions[current.name] = []; facadeVersions[current.name].push(...current.versions); } else { diff --git a/api/facades/application/ApplicationV19.ts b/api/facades/application/ApplicationV19.ts new file mode 100644 index 000000000..d6ed1f42a --- /dev/null +++ b/api/facades/application/ApplicationV19.ts @@ -0,0 +1,1125 @@ +/** + Juju Application version 19. + This facade is available on: + Controller-machine-agent + Machine-agent + Unit-agent + Models + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface AddApplicationUnits { + application: string; + "attach-storage"?: string[]; + "num-units": number; + placement: Placement[]; + policy?: string; +} + +export interface AddApplicationUnitsResults { + units: string[]; +} + +export interface AddRelation { + endpoints: string[]; + "via-cidrs"?: string[]; +} + +export interface AddRelationResults { + endpoints: Record; +} + +export interface ApplicationCharmRelations { + application: string; +} + +export interface ApplicationCharmRelationsResults { + "charm-relations": string[]; +} + +export interface ApplicationConfigUnsetArgs { + Args: ApplicationUnset[]; +} + +export interface ApplicationConstraint { + constraints: Value; + error?: Error; +} + +export interface ApplicationDeploy { + Force: boolean; + application: string; + "attach-storage"?: string[]; + channel: string; + "charm-origin"?: CharmOrigin; + "charm-url": string; + config?: Record; + "config-yaml": string; + constraints: Value; + devices?: Record; + "endpoint-bindings"?: Record; + "num-units": number; + placement?: Placement[]; + policy?: string; + resources?: Record; + storage?: Record; +} + +export interface ApplicationExpose { + application: string; + "exposed-endpoints"?: Record; +} + +export interface ApplicationGet { + application: string; + branch: string; +} + +export interface ApplicationGetArgs { + args: ApplicationGet[]; +} + +export interface ApplicationGetConfigResults { + Results: ConfigResult[]; +} + +export interface ApplicationGetConstraintsResults { + results: ApplicationConstraint[]; +} + +export interface ApplicationGetResults { + application: string; + "application-config"?: AdditionalProperties; + base: Base; + channel: string; + charm: string; + config: AdditionalProperties; + constraints: Value; + "endpoint-bindings"?: Record; +} + +export interface ApplicationInfoResult { + error: Error; + result: ApplicationResult; +} + +export interface ApplicationInfoResults { + results: ApplicationInfoResult[]; +} + +export interface ApplicationMergeBindings { + "application-tag": string; + bindings: Record; + force: boolean; +} + +export interface ApplicationMergeBindingsArgs { + args: ApplicationMergeBindings[]; +} + +export interface ApplicationMetricCredential { + application: string; + "metrics-credentials": number[]; +} + +export interface ApplicationMetricCredentials { + creds: ApplicationMetricCredential[]; +} + +export interface ApplicationOfferDetails { + "application-description": string; + bindings?: Record; + endpoints?: RemoteEndpoint[]; + "offer-name": string; + "offer-url": string; + "offer-uuid": string; + "source-model-tag": string; + spaces?: RemoteSpace[]; + users?: OfferUserDetails[]; +} + +export interface ApplicationResult { + base?: Base; + channel?: string; + charm?: string; + constraints?: Value; + "endpoint-bindings"?: Record; + exposed: boolean; + "exposed-endpoints"?: Record; + life: string; + principal: boolean; + remote: boolean; + tag: string; +} + +export interface ApplicationSetCharm { + application: string; + channel: string; + "charm-origin"?: CharmOrigin; + "charm-url": string; + "config-settings"?: Record; + "config-settings-yaml"?: string; + "endpoint-bindings"?: Record; + force: boolean; + "force-base": boolean; + "force-units": boolean; + generation: string; + "resource-ids"?: Record; + "storage-constraints"?: Record; +} + +export interface ApplicationUnexpose { + application: string; + "exposed-endpoints": string[]; +} + +export interface ApplicationUnset { + application: string; + branch: string; + options: string[]; +} + +export interface ApplicationsDeploy { + applications: ApplicationDeploy[]; +} + +export interface Base { + channel: string; + name: string; +} + +export interface CharmOrigin { + architecture?: string; + base?: Base; + branch?: string; + hash?: string; + id: string; + "instance-key"?: string; + revision?: number; + risk?: string; + source: string; + track?: string; + type: string; +} + +export interface CharmRelation { + interface: string; + limit: number; + name: string; + optional: boolean; + role: string; + scope: string; +} + +export interface CharmURLOriginResult { + "charm-origin": CharmOrigin; + error?: Error; + url: string; +} + +export interface ConfigResult { + config: AdditionalProperties; + error?: Error; +} + +export interface ConfigSet { + application: string; + config: Record; + "config-yaml": string; + generation: string; +} + +export interface ConfigSetArgs { + Args: ConfigSet[]; +} + +export interface Constraints { + Count: number; + Pool: string; + Size: number; +} + +export interface ConsumeApplicationArg { + ApplicationOfferDetails: ApplicationOfferDetails; + "application-alias"?: string; + "application-description": string; + bindings?: Record; + endpoints?: RemoteEndpoint[]; + "external-controller"?: ExternalControllerInfo; + macaroon?: Macaroon; + "offer-name": string; + "offer-url": string; + "offer-uuid": string; + "source-model-tag": string; + spaces?: RemoteSpace[]; + users?: OfferUserDetails[]; +} + +export interface ConsumeApplicationArgs { + args: ConsumeApplicationArg[]; +} + +export interface DeployFromRepositoryArg { + ApplicationName: string; + AttachStorage: string[]; + CharmName: string; + ConfigYAML: string; + Cons: Value; + Devices: Record; + DryRun: boolean; + Placement: Placement[]; + Storage: Record; + Trust: boolean; + base?: Base; + channel?: string; + "endpoint-bindings"?: Record; + force?: boolean; + "num-units"?: number; + resources?: Record; + revision?: number; +} + +export interface DeployFromRepositoryArgs { + Args: DeployFromRepositoryArg[]; +} + +export interface DeployFromRepositoryInfo { + architecture: string; + base?: Base; + channel: string; + "effective-channel"?: string; + name: string; + revision: number; +} + +export interface DeployFromRepositoryResult { + Errors: Error[]; + Info: DeployFromRepositoryInfo; + PendingResourceUploads: PendingResourceUpload[]; +} + +export interface DeployFromRepositoryResults { + Results: DeployFromRepositoryResult[]; +} + +export interface DestroyApplicationInfo { + "destroyed-storage": Entity[]; + "destroyed-units": Entity[]; + "detached-storage": Entity[]; +} + +export interface DestroyApplicationParams { + "application-tag": string; + "destroy-storage"?: boolean; + "dry-run"?: boolean; + force: boolean; + "max-wait"?: number; +} + +export interface DestroyApplicationResult { + error: Error; + info: DestroyApplicationInfo; +} + +export interface DestroyApplicationResults { + results: DestroyApplicationResult[]; +} + +export interface DestroyApplicationsParams { + applications: DestroyApplicationParams[]; +} + +export interface DestroyConsumedApplicationParams { + "application-tag": string; + force?: boolean; + "max-wait"?: number; +} + +export interface DestroyConsumedApplicationsParams { + applications: DestroyConsumedApplicationParams[]; +} + +export interface DestroyRelation { + endpoints?: string[]; + force?: boolean; + "max-wait"?: number; + "relation-id": number; +} + +export interface DestroyUnitInfo { + "destroyed-storage": Entity[]; + "detached-storage": Entity[]; +} + +export interface DestroyUnitParams { + "destroy-storage"?: boolean; + "dry-run"?: boolean; + force?: boolean; + "max-wait"?: number; + "unit-tag": string; +} + +export interface DestroyUnitResult { + error: Error; + info: DestroyUnitInfo; +} + +export interface DestroyUnitResults { + results: DestroyUnitResult[]; +} + +export interface DestroyUnitsParams { + units: DestroyUnitParams[]; +} + +export interface EndpointRelationData { + ApplicationData: AdditionalProperties; + "cross-model": boolean; + endpoint: string; + "related-endpoint": string; + "relation-id": number; + "unit-relation-data": Record; +} + +export interface Entities { + entities: Entity[]; +} + +export interface Entity { + tag: string; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface ExposedEndpoint { + "expose-to-cidrs": string[]; + "expose-to-spaces": string[]; +} + +export interface ExternalControllerInfo { + addrs: string[]; + "ca-cert": string; + "controller-alias": string; + "controller-tag": string; +} + +export interface Macaroon { + [key: string]: AdditionalProperties; +} + +export interface OfferUserDetails { + access: string; + "display-name": string; + user: string; +} + +export interface PendingResourceUpload { + Filename: string; + Name: string; + Type: string; +} + +export interface Placement { + directive: string; + scope: string; +} + +export interface RelationData { + InScope: boolean; + UnitData: AdditionalProperties; +} + +export interface RelationSuspendedArg { + message: string; + "relation-id": number; + suspended: boolean; +} + +export interface RelationSuspendedArgs { + args: RelationSuspendedArg[]; +} + +export interface RemoteEndpoint { + interface: string; + limit: number; + name: string; + role: string; +} + +export interface RemoteSpace { + "cloud-type": string; + name: string; + "provider-attributes": AdditionalProperties; + "provider-id": string; + subnets: Subnet[]; +} + +export interface ScaleApplicationInfo { + "num-units": number; +} + +export interface ScaleApplicationParams { + "application-tag": string; + force: boolean; + scale: number; + "scale-change"?: number; +} + +export interface ScaleApplicationResult { + error: Error; + info: ScaleApplicationInfo; +} + +export interface ScaleApplicationResults { + results: ScaleApplicationResult[]; +} + +export interface ScaleApplicationsParams { + applications: ScaleApplicationParams[]; +} + +export interface SetConstraints { + application: string; + constraints: Value; +} + +export interface StorageConstraints { + count: number; + pool: string; + size: number; +} + +export interface StringResult { + error?: Error; + result: string; +} + +export interface Subnet { + cidr: string; + life: string; + "provider-id"?: string; + "provider-network-id"?: string; + "provider-space-id"?: string; + "space-tag": string; + status?: string; + "vlan-tag": number; + zones: string[]; +} + +export interface UnitInfoResult { + error: Error; + result: UnitResult; +} + +export interface UnitInfoResults { + results: UnitInfoResult[]; +} + +export interface UnitResult { + address?: string; + charm: string; + leader?: boolean; + life?: string; + machine?: string; + "opened-ports": string[]; + "provider-id"?: string; + "public-address"?: string; + "relation-data"?: EndpointRelationData[]; + tag: string; + "workload-version": string; +} + +export interface UnitsResolved { + all: boolean; + retry: boolean; + tags: Entities; +} + +export interface UpdateChannelArg { + channel: string; + force: boolean; + tag: Entity; +} + +export interface UpdateChannelArgs { + args: UpdateChannelArg[]; +} + +export interface Value { + "allocate-public-ip": boolean; + arch: string; + container: string; + cores: number; + "cpu-power": number; + "image-id": string; + "instance-role": string; + "instance-type": string; + mem: number; + "root-disk": number; + "root-disk-source": string; + spaces: string[]; + tags: string[]; + "virt-type": string; + zones: string[]; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + APIv19 provides the Application API facade for version 19. +*/ +class ApplicationV19 implements Facade { + static NAME = "Application"; + static VERSION = 19; + + NAME = "Application"; + VERSION = 19; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + AddRelation adds a relation between the specified endpoints and returns the relation info. + */ + addRelation(params: AddRelation): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "AddRelation", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + AddUnits adds a given number of units to an application. + */ + addUnits(params: AddApplicationUnits): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "AddUnits", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ApplicationsInfo returns applications information. + */ + applicationsInfo(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "ApplicationsInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmConfig returns charm config for the input list of applications and + model generations. + */ + charmConfig( + params: ApplicationGetArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "CharmConfig", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmRelations implements the server side of Application.CharmRelations. + */ + charmRelations( + params: ApplicationCharmRelations + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "CharmRelations", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Consume adds remote applications to the model without creating any + relations. + */ + consume(params: ConsumeApplicationArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Consume", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Deploy fetches the charms from the charm store and deploys them + using the specified placement directives. + */ + deploy(params: ApplicationsDeploy): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Deploy", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DeployFromRepository is a one-stop deployment method for repository + charms. Only a charm name is required to deploy. If argument validation + fails, a list of all errors found in validation will be returned. If a + local resource is provided, details required for uploading the validated + resource will be returned. + */ + deployFromRepository( + params: DeployFromRepositoryArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "DeployFromRepository", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyApplication removes a given set of applications. + */ + destroyApplication( + params: DestroyApplicationsParams + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "DestroyApplication", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyConsumedApplications removes a given set of consumed (remote) applications. + */ + destroyConsumedApplications( + params: DestroyConsumedApplicationsParams + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "DestroyConsumedApplications", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyRelation removes the relation between the + specified endpoints or an id. + */ + destroyRelation(params: DestroyRelation): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "DestroyRelation", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyUnit removes a given set of application units. + */ + destroyUnit(params: DestroyUnitsParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "DestroyUnit", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Expose changes the juju-managed firewall to expose any ports that + were also explicitly marked by units as open. + */ + expose(params: ApplicationExpose): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Expose", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Get returns the charm configuration for an application. + */ + get(params: ApplicationGet): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Get", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetCharmURLOrigin returns the charm URL and charm origin the given + application is running at present. + */ + getCharmURLOrigin(params: ApplicationGet): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "GetCharmURLOrigin", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetConfig returns the charm config for each of the input applications. + */ + getConfig(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "GetConfig", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetConstraints returns the constraints for a given application. + */ + getConstraints(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "GetConstraints", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Leader returns the unit name of the leader for the given application. + */ + leader(params: Entity): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Leader", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + MergeBindings merges operator-defined bindings with the current bindings for + one or more applications. + */ + mergeBindings(params: ApplicationMergeBindingsArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "MergeBindings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ResolveUnitErrors marks errors on the specified units as resolved. + */ + resolveUnitErrors(params: UnitsResolved): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "ResolveUnitErrors", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ScaleApplications scales the specified application to the requested number of units. + */ + scaleApplications( + params: ScaleApplicationsParams + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "ScaleApplications", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetCharm sets the charm for a given for the application. + */ + setCharm(params: ApplicationSetCharm): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "SetCharm", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetConfigs implements the server side of Application.SetConfig. Both + application and charm config are set. It does not unset values in + Config map that are set to an empty string. Unset should be used for that. + */ + setConfigs(params: ConfigSetArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "SetConfigs", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetConstraints sets the constraints for a given application. + */ + setConstraints(params: SetConstraints): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "SetConstraints", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetMetricCredentials sets credentials on the application. + TODO (cderici) only used for metered charms in cmd MeteredDeployAPI, + kept for client compatibility, remove in juju 4.0 + */ + setMetricCredentials( + params: ApplicationMetricCredentials + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "SetMetricCredentials", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetRelationsSuspended sets the suspended status of the specified relations. + */ + setRelationsSuspended(params: RelationSuspendedArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "SetRelationsSuspended", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Unexpose changes the juju-managed firewall to unexpose any ports that + were also explicitly marked by units as open. + */ + unexpose(params: ApplicationUnexpose): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "Unexpose", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UnitsInfo returns unit information for the given entities (units or + applications). + */ + unitsInfo(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "UnitsInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UnsetApplicationsConfig implements the server side of Application.UnsetApplicationsConfig. + */ + unsetApplicationsConfig( + params: ApplicationConfigUnsetArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "UnsetApplicationsConfig", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UpdateApplicationBase updates the application base. + Base for subordinates is updated too. + */ + updateApplicationBase(params: UpdateChannelArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Application", + request: "UpdateApplicationBase", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default ApplicationV19; diff --git a/api/facades/application/index.ts b/api/facades/application/index.ts index 2716eb956..c379b56db 100644 --- a/api/facades/application/index.ts +++ b/api/facades/application/index.ts @@ -4,12 +4,14 @@ import ApplicationV13 from "./ApplicationV13.js"; import ApplicationV14 from "./ApplicationV14.js"; import ApplicationV15 from "./ApplicationV15.js"; import ApplicationV18 from "./ApplicationV18.js"; +import ApplicationV19 from "./ApplicationV19.js"; export * as ApplicationV12 from "./ApplicationV12.js"; export * as ApplicationV13 from "./ApplicationV13.js"; export * as ApplicationV14 from "./ApplicationV14.js"; export * as ApplicationV15 from "./ApplicationV15.js"; export * as ApplicationV18 from "./ApplicationV18.js"; +export * as ApplicationV19 from "./ApplicationV19.js"; const Application: GenericFacade = { name: "Application", @@ -19,6 +21,7 @@ const Application: GenericFacade = { ApplicationV14, ApplicationV15, ApplicationV18, + ApplicationV19, ], }; diff --git a/api/facades/charms/CharmsV7.ts b/api/facades/charms/CharmsV7.ts new file mode 100644 index 000000000..1dbfc95af --- /dev/null +++ b/api/facades/charms/CharmsV7.ts @@ -0,0 +1,470 @@ +/** + Juju Charms version 7. + This facade is available on: + Models + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface AddCharmWithOrigin { + "charm-origin": CharmOrigin; + force: boolean; + url: string; +} + +export interface ApplicationCharmPlacement { + application: string; + "charm-url": string; +} + +export interface ApplicationCharmPlacements { + placements: ApplicationCharmPlacement[]; +} + +export interface Base { + channel: string; + name: string; +} + +export interface Charm { + actions?: CharmActions; + config: Record; + "lxd-profile"?: CharmLXDProfile; + manifest?: CharmManifest; + meta?: CharmMeta; + metrics?: CharmMetrics; + revision: number; + url: string; +} + +export interface CharmActionSpec { + description: string; + params: AdditionalProperties; +} + +export interface CharmActions { + specs: Record; +} + +export interface CharmBase { + architectures: string[]; + channel: string; + name: string; +} + +export interface CharmContainer { + mounts: CharmMount[]; + resource: string; +} + +export interface CharmDeployment { + "min-version": string; + mode: string; + service: string; + type: string; +} + +export interface CharmDevice { + CountMax: number; + CountMin: number; + Description: string; + Name: string; + Type: string; +} + +export interface CharmLXDProfile { + config: Record; + description: string; + devices: Record>; +} + +export interface CharmManifest { + bases: CharmBase[]; +} + +export interface CharmMeta { + "assumes-expr"?: ExpressionTree; + categories?: string[]; + containers?: Record; + deployment?: CharmDeployment; + description: string; + devices?: Record; + "extra-bindings"?: Record; + "min-juju-version"?: string; + name: string; + "payload-classes"?: Record; + peers?: Record; + provides?: Record; + requires?: Record; + resources?: Record; + series?: string[]; + storage?: Record; + subordinate: boolean; + summary: string; + tags?: string[]; + terms?: string[]; +} + +export interface CharmMetric { + description: string; + type: string; +} + +export interface CharmMetrics { + metrics: Record; + plan: CharmPlan; +} + +export interface CharmMount { + location: string; + storage: string; +} + +export interface CharmOption { + default?: AdditionalProperties; + description?: string; + type: string; +} + +export interface CharmOrigin { + architecture?: string; + base?: Base; + branch?: string; + hash?: string; + id: string; + "instance-key"?: string; + revision?: number; + risk?: string; + source: string; + track?: string; + type: string; +} + +export interface CharmOriginResult { + "charm-origin": CharmOrigin; + error?: Error; +} + +export interface CharmPayloadClass { + name: string; + type: string; +} + +export interface CharmPlan { + required: boolean; +} + +export interface CharmRelation { + interface: string; + limit: number; + name: string; + optional: boolean; + role: string; + scope: string; +} + +export interface CharmResource { + description?: string; + fingerprint: number[]; + name: string; + origin: string; + path: string; + revision: number; + size: number; + type: string; +} + +export interface CharmResourceMeta { + description: string; + name: string; + path: string; + type: string; +} + +export interface CharmResourceResult { + CharmResource: CharmResource; + ErrorResult: ErrorResult; + description?: string; + error?: Error; + fingerprint: number[]; + name: string; + origin: string; + path: string; + revision: number; + size: number; + type: string; +} + +export interface CharmResourcesResults { + results: CharmResourceResult[][]; +} + +export interface CharmStorage { + "count-max": number; + "count-min": number; + description: string; + location?: string; + "minimum-size": number; + name: string; + properties?: string[]; + "read-only": boolean; + shared: boolean; + type: string; +} + +export interface CharmURL { + url: string; +} + +export interface CharmURLAndOrigin { + "charm-origin": CharmOrigin; + "charm-url": string; + macaroon?: Macaroon; +} + +export interface CharmURLAndOrigins { + entities: CharmURLAndOrigin[]; +} + +export interface CharmsList { + names: string[]; +} + +export interface CharmsListResult { + "charm-urls": string[]; +} + +export interface DownloadInfoResult { + "charm-origin": CharmOrigin; + url: string; +} + +export interface DownloadInfoResults { + results: DownloadInfoResult[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface ExpressionTree { + Expression: AdditionalProperties; +} + +export interface IsMeteredResult { + metered: boolean; +} + +export interface Macaroon { + [key: string]: AdditionalProperties; +} + +export interface ResolveCharmWithChannel { + "charm-origin": CharmOrigin; + reference: string; + "switch-charm"?: boolean; +} + +export interface ResolveCharmWithChannelResult { + "charm-origin": CharmOrigin; + error?: Error; + "supported-bases": Base[]; + url: string; +} + +export interface ResolveCharmWithChannelResults { + Results: ResolveCharmWithChannelResult[]; +} + +export interface ResolveCharmsWithChannel { + macaroon?: Macaroon; + resolve: ResolveCharmWithChannel[]; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + APIv7 provides the Charms API facade for version 7. + v7 guarantees SupportedBases will be provided in ResolveCharms +*/ +class CharmsV7 implements Facade { + static NAME = "Charms"; + static VERSION = 7; + + NAME = "Charms"; + VERSION = 7; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + AddCharm adds the given charm URL (which must include revision) to the + environment, if it does not exist yet. Local charms are not supported, + only charm store and charm hub URLs. See also AddLocalCharm(). + */ + addCharm(params: AddCharmWithOrigin): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "AddCharm", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmInfo returns information about the requested charm. + */ + charmInfo(params: CharmURL): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "CharmInfo", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CheckCharmPlacement checks if a charm is allowed to be placed with in a + given application. + */ + checkCharmPlacement( + params: ApplicationCharmPlacements + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "CheckCharmPlacement", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetDownloadInfos attempts to get the bundle corresponding to the charm url + and origin. + */ + getDownloadInfos(params: CharmURLAndOrigins): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "GetDownloadInfos", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + IsMetered returns whether or not the charm is metered. + TODO (cderici) only used for metered charms in cmd MeteredDeployAPI, + kept for client compatibility, remove in juju 4.0 + */ + isMetered(params: CharmURL): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "IsMetered", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + List returns a list of charm URLs currently in the state. + If supplied parameter contains any names, the result will + be filtered to return only the charms with supplied names. + */ + list(params: CharmsList): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "List", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ListCharmResources returns a series of resources for a given charm. + */ + listCharmResources( + params: CharmURLAndOrigins + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "ListCharmResources", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ResolveCharms resolves the given charm URLs with an optionally specified + preferred channel. Channel provided via CharmOrigin. + */ + resolveCharms( + params: ResolveCharmsWithChannel + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Charms", + request: "ResolveCharms", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default CharmsV7; diff --git a/api/facades/charms/index.ts b/api/facades/charms/index.ts index 31832caa2..d44a45ba5 100644 --- a/api/facades/charms/index.ts +++ b/api/facades/charms/index.ts @@ -3,15 +3,17 @@ import CharmsV2 from "./CharmsV2.js"; import CharmsV4 from "./CharmsV4.js"; import CharmsV5 from "./CharmsV5.js"; import CharmsV6 from "./CharmsV6.js"; +import CharmsV7 from "./CharmsV7.js"; export * as CharmsV2 from "./CharmsV2.js"; export * as CharmsV4 from "./CharmsV4.js"; export * as CharmsV5 from "./CharmsV5.js"; export * as CharmsV6 from "./CharmsV6.js"; +export * as CharmsV7 from "./CharmsV7.js"; const Charms: GenericFacade = { name: "Charms", - versions: [CharmsV2, CharmsV4, CharmsV5, CharmsV6], + versions: [CharmsV2, CharmsV4, CharmsV5, CharmsV6, CharmsV7], }; export default Charms; diff --git a/api/facades/client/ClientV7.ts b/api/facades/client/ClientV7.ts new file mode 100644 index 000000000..7ef17c669 --- /dev/null +++ b/api/facades/client/ClientV7.ts @@ -0,0 +1,466 @@ +/** + Juju Client version 7. + This facade is available on: + Controller-machine-agent + Machine-agent + Unit-agent + Models + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface AllWatcherId { + "watcher-id": string; +} + +export interface ApplicationOfferStatus { + "active-connected-count": number; + "application-name": string; + charm: string; + endpoints: Record; + err?: Error; + "offer-name": string; + "total-connected-count": number; +} + +export interface ApplicationStatus { + base: Base; + "can-upgrade-to": string; + charm: string; + "charm-channel"?: string; + "charm-profile": string; + "charm-version": string; + "endpoint-bindings": Record; + err?: Error; + exposed: boolean; + "exposed-endpoints"?: Record; + int?: number; + life: string; + "meter-statuses": Record; + "provider-id"?: string; + "public-address": string; + relations: Record; + status: DetailedStatus; + "subordinate-to": string[]; + units: Record; + "workload-version": string; +} + +export interface Base { + channel: string; + name: string; +} + +export interface Binary { + Arch: string; + Build: number; + Major: number; + Minor: number; + Number: Number; + Patch: number; + Release: string; + Tag: string; +} + +export interface BranchStatus { + "assigned-units": Record; + created: number; + "created-by": string; +} + +export interface DetailedStatus { + data: AdditionalProperties; + err?: Error; + info: string; + kind: string; + life: string; + since: string; + status: string; + version: string; +} + +export interface EndpointStatus { + application: string; + name: string; + role: string; + subordinate: boolean; +} + +export interface EntityStatus { + data?: AdditionalProperties; + info: string; + since: string; + status: string; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ExposedEndpoint { + "expose-to-cidrs": string[]; + "expose-to-spaces": string[]; +} + +export interface FilesystemAttachmentDetails { + FilesystemAttachmentInfo: FilesystemAttachmentInfo; + life?: string; + "mount-point"?: string; + "read-only"?: boolean; +} + +export interface FilesystemAttachmentInfo { + "mount-point": string; + "read-only": boolean; +} + +export interface FilesystemDetails { + "filesystem-tag": string; + info: FilesystemInfo; + life?: string; + "machine-attachments"?: Record; + status: EntityStatus; + storage?: StorageDetails; + "unit-attachments"?: Record; + "volume-tag"?: string; +} + +export interface FilesystemInfo { + "filesystem-id": string; + pool: string; + size: number; +} + +export interface FindToolsParams { + agentstream: string; + arch: string; + major: number; + number: Number; + "os-type": string; +} + +export interface FindToolsResult { + error?: Error; + list: Tools[]; +} + +export interface FullStatus { + applications: Record; + branches: Record; + "controller-timestamp": string; + filesystems?: FilesystemDetails[]; + machines: Record; + model: ModelStatusInfo; + offers: Record; + relations: RelationStatus[]; + "remote-applications": Record; + storage?: StorageDetails[]; + volumes?: VolumeDetails[]; +} + +export interface History { + error?: Error; + statuses: DetailedStatus[]; +} + +export interface LXDProfile { + config: Record; + description: string; + devices: Record>; +} + +export interface MachineStatus { + "agent-status": DetailedStatus; + base: Base; + constraints: string; + containers: Record; + "display-name": string; + "dns-name": string; + hardware: string; + "has-vote": boolean; + hostname?: string; + id: string; + "instance-id": string; + "instance-status": DetailedStatus; + "ip-addresses"?: string[]; + jobs: string[]; + "lxd-profiles"?: Record; + "modification-status": DetailedStatus; + "network-interfaces"?: Record; + "primary-controller-machine"?: boolean; + "wants-vote": boolean; +} + +export interface MeterStatus { + color: string; + message: string; +} + +export interface ModelStatusInfo { + "available-version": string; + "cloud-tag": string; + "meter-status": MeterStatus; + "model-status": DetailedStatus; + name: string; + region?: string; + sla: string; + type: string; + version: string; +} + +export interface NetworkInterface { + "dns-nameservers"?: string[]; + gateway?: string; + "ip-addresses": string[]; + "is-up": boolean; + "mac-address": string; + space?: string; +} + +export interface Number { + Build: number; + Major: number; + Minor: number; + Patch: number; + Tag: string; +} + +export interface RelationStatus { + endpoints: EndpointStatus[]; + id: number; + interface: string; + key: string; + scope: string; + status: DetailedStatus; +} + +export interface RemoteApplicationStatus { + endpoints: RemoteEndpoint[]; + err?: Error; + life: string; + "offer-name": string; + "offer-url": string; + relations: Record; + status: DetailedStatus; +} + +export interface RemoteEndpoint { + interface: string; + limit: number; + name: string; + role: string; +} + +export interface StatusHistoryFilter { + date: string; + delta: number; + exclude: string[]; + size: number; +} + +export interface StatusHistoryRequest { + filter: StatusHistoryFilter; + historyKind: string; + size: number; + tag: string; +} + +export interface StatusHistoryRequests { + requests: StatusHistoryRequest[]; +} + +export interface StatusHistoryResult { + error?: Error; + history: History; +} + +export interface StatusHistoryResults { + results: StatusHistoryResult[]; +} + +export interface StatusParams { + "include-storage"?: boolean; + patterns: string[]; +} + +export interface StorageAttachmentDetails { + life?: string; + location?: string; + "machine-tag": string; + "storage-tag": string; + "unit-tag": string; +} + +export interface StorageDetails { + attachments?: Record; + kind: number; + life?: string; + "owner-tag": string; + persistent: boolean; + status: EntityStatus; + "storage-tag": string; +} + +export interface Tools { + sha256?: string; + size: number; + url: string; + version: Binary; +} + +export interface UnitStatus { + address?: string; + "agent-status": DetailedStatus; + charm: string; + leader?: boolean; + machine: string; + "opened-ports": string[]; + "provider-id"?: string; + "public-address": string; + subordinates: Record; + "workload-status": DetailedStatus; + "workload-version": string; +} + +export interface VolumeAttachmentDetails { + VolumeAttachmentInfo: VolumeAttachmentInfo; + "bus-address"?: string; + "device-link"?: string; + "device-name"?: string; + life?: string; + "plan-info"?: VolumeAttachmentPlanInfo; + "read-only"?: boolean; +} + +export interface VolumeAttachmentInfo { + "bus-address": string; + "device-link": string; + "device-name": string; + "plan-info": VolumeAttachmentPlanInfo; + "read-only": boolean; +} + +export interface VolumeAttachmentPlanInfo { + "device-attributes": Record; + "device-type": string; +} + +export interface VolumeDetails { + info: VolumeInfo; + life?: string; + "machine-attachments"?: Record; + status: EntityStatus; + storage?: StorageDetails; + "unit-attachments"?: Record; + "volume-tag": string; +} + +export interface VolumeInfo { + "hardware-id"?: string; + persistent: boolean; + pool?: string; + size: number; + "volume-id": string; + wwn?: string; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + Client serves client-specific API methods. +*/ +class ClientV7 implements Facade { + static NAME = "Client"; + static VERSION = 7; + + NAME = "Client"; + VERSION = 7; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + FindTools returns a List containing all tools matching the given parameters. + TODO(juju 3.1) - remove, used by 2.9 client only + */ + findTools(params: FindToolsParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Client", + request: "FindTools", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + FullStatus gives the information needed for juju status over the api + */ + fullStatus(params: StatusParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Client", + request: "FullStatus", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + StatusHistory returns a slice of past statuses for several entities. + */ + statusHistory(params: StatusHistoryRequests): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Client", + request: "StatusHistory", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchAll initiates a watcher for entities in the connected model. + */ + watchAll(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Client", + request: "WatchAll", + version: 7, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default ClientV7; diff --git a/api/facades/client/index.ts b/api/facades/client/index.ts index 09b7f14f5..712a60bcb 100644 --- a/api/facades/client/index.ts +++ b/api/facades/client/index.ts @@ -3,15 +3,17 @@ import ClientV2 from "./ClientV2.js"; import ClientV3 from "./ClientV3.js"; import ClientV5 from "./ClientV5.js"; import ClientV6 from "./ClientV6.js"; +import ClientV7 from "./ClientV7.js"; export * as ClientV2 from "./ClientV2.js"; export * as ClientV3 from "./ClientV3.js"; export * as ClientV5 from "./ClientV5.js"; export * as ClientV6 from "./ClientV6.js"; +export * as ClientV7 from "./ClientV7.js"; const Client: GenericFacade = { name: "Client", - versions: [ClientV2, ClientV3, ClientV5, ClientV6], + versions: [ClientV2, ClientV3, ClientV5, ClientV6, ClientV7], }; export default Client; diff --git a/api/facades/migration-target/MigrationTargetV3.ts b/api/facades/migration-target/MigrationTargetV3.ts new file mode 100644 index 000000000..e27fab164 --- /dev/null +++ b/api/facades/migration-target/MigrationTargetV3.ts @@ -0,0 +1,281 @@ +/** + Juju MigrationTarget version 3. + This facade is available on: + Controllers + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface ActivateModelArgs { + "controller-alias"?: string; + "controller-tag": string; + "cross-model-uuids": string[]; + "model-tag": string; + "source-api-addrs": string[]; + "source-ca-cert": string; +} + +export interface AdoptResourcesArgs { + "model-tag": string; + "source-controller-version": Number; +} + +export interface BytesResult { + result: number[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface MigrationModelInfo { + "agent-version": string; + "controller-agent-version": Number; + "facade-versions"?: Record; + name: string; + "owner-tag": string; + uuid: string; +} + +export interface ModelArgs { + "model-tag": string; +} + +export interface Number { + Build: number; + Major: number; + Minor: number; + Patch: number; + Tag: string; +} + +export interface SerializedModel { + bytes: number[]; + charms: string[]; + resources: SerializedModelResource[]; + tools: SerializedModelTools[]; +} + +export interface SerializedModelResource { + application: string; + "application-revision": SerializedModelResourceRevision; + "charmstore-revision": SerializedModelResourceRevision; + name: string; + "unit-revisions": Record; +} + +export interface SerializedModelResourceRevision { + description: string; + fingerprint: string; + origin: string; + path: string; + revision: number; + size: number; + timestamp: string; + type: string; + username?: string; +} + +export interface SerializedModelTools { + uri: string; + version: string; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + API implements the API required for the model migration + master worker when communicating with the target controller. +*/ +class MigrationTargetV3 implements Facade { + static NAME = "MigrationTarget"; + static VERSION = 3; + + NAME = "MigrationTarget"; + VERSION = 3; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + Abort removes the specified model from the database. It is an error to + attempt to Abort a model that has a migration mode other than importing. + */ + abort(params: ModelArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "Abort", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Activate sets the migration mode of the model to "none", meaning it + is ready for use. It is an error to attempt to Abort a model that + has a migration mode other than importing. It also adds any required + external controller records for those controllers hosting offers used + by the model. + */ + activate(params: ActivateModelArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "Activate", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + AdoptResources asks the cloud provider to update the controller + tags for a model's resources. This prevents the resources from + being destroyed if the source controller is destroyed after the + model is migrated away. + */ + adoptResources(params: AdoptResourcesArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "AdoptResources", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CACert returns the certificate used to validate the state connection. + */ + cACert(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "CACert", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CheckMachines compares the machines in state with the ones reported + by the provider and reports any discrepancies. + */ + checkMachines(params: ModelArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "CheckMachines", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Import takes a serialized Juju model, deserializes it, and + recreates it in the receiving controller. + */ + import(params: SerializedModel): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "Import", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + LatestLogTime returns the time of the most recent log record + received by the logtransfer endpoint. This can be used as the start + point for streaming logs from the source if the transfer was + interrupted. + + For performance reasons, not every time is tracked, so if the + target controller died during the transfer the latest log time + might be up to 2 minutes earlier. If the transfer was interrupted + in some other way (like the source controller going away or a + network partition) the time will be up-to-date. + + Log messages are assumed to be sent in time order (which is how + debug-log emits them). If that isn't the case then this mechanism + can't be used to avoid duplicates when logtransfer is restarted. + + Returns the zero time if no logs have been transferred. + */ + latestLogTime(params: ModelArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "LatestLogTime", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Prechecks ensure that the target controller is ready to accept a + model migration. + */ + prechecks(params: MigrationModelInfo): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "MigrationTarget", + request: "Prechecks", + version: 3, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default MigrationTargetV3; diff --git a/api/facades/migration-target/index.ts b/api/facades/migration-target/index.ts index 48db84b0b..c3f2e685c 100644 --- a/api/facades/migration-target/index.ts +++ b/api/facades/migration-target/index.ts @@ -1,13 +1,15 @@ import { GenericFacade } from "../../types"; import MigrationTargetV1 from "./MigrationTargetV1.js"; import MigrationTargetV2 from "./MigrationTargetV2.js"; +import MigrationTargetV3 from "./MigrationTargetV3.js"; export * as MigrationTargetV1 from "./MigrationTargetV1.js"; export * as MigrationTargetV2 from "./MigrationTargetV2.js"; +export * as MigrationTargetV3 from "./MigrationTargetV3.js"; const MigrationTarget: GenericFacade = { name: "MigrationTarget", - versions: [MigrationTargetV1, MigrationTargetV2], + versions: [MigrationTargetV1, MigrationTargetV2, MigrationTargetV3], }; export default MigrationTarget; diff --git a/api/facades/secrets/SecretsV2.ts b/api/facades/secrets/SecretsV2.ts new file mode 100644 index 000000000..b2b736e75 --- /dev/null +++ b/api/facades/secrets/SecretsV2.ts @@ -0,0 +1,281 @@ +/** + Juju Secrets version 2. + This facade is available on: + Models + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface AccessInfo { + role: string; + "scope-tag": string; + "target-tag": string; +} + +export interface CreateSecretArg { + UpsertSecretArg: UpsertSecretArg; + content?: SecretContentParams; + description?: string; + "expire-time"?: string; + label?: string; + "owner-tag": string; + params?: AdditionalProperties; + "rotate-policy"?: string; + uri?: string; +} + +export interface CreateSecretArgs { + args: CreateSecretArg[]; +} + +export interface DeleteSecretArg { + label: string; + revisions?: number[]; + uri: string; +} + +export interface DeleteSecretArgs { + args: DeleteSecretArg[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface GrantRevokeUserSecretArg { + applications: string[]; + label: string; + uri: string; +} + +export interface ListSecretResult { + access?: AccessInfo[]; + "create-time": string; + description?: string; + label?: string; + "latest-expire-time"?: string; + "latest-revision": number; + "next-rotate-time"?: string; + "owner-tag": string; + revisions: SecretRevision[]; + "rotate-policy"?: string; + "update-time": string; + uri: string; + value?: SecretValueResult; + version: number; +} + +export interface ListSecretResults { + results: ListSecretResult[]; +} + +export interface ListSecretsArgs { + filter: SecretsFilter; + "show-secrets": boolean; +} + +export interface SecretContentParams { + data: Record; + "value-ref": SecretValueRef; +} + +export interface SecretRevision { + "backend-name"?: string; + "create-time"?: string; + "expire-time"?: string; + revision: number; + "update-time"?: string; + "value-ref"?: SecretValueRef; +} + +export interface SecretValueRef { + "backend-id": string; + "revision-id": string; +} + +export interface SecretValueResult { + data: Record; + error: Error; +} + +export interface SecretsFilter { + label: string; + "owner-tag": string; + revision: number; + uri: string; +} + +export interface StringResult { + error?: Error; + result: string; +} + +export interface StringResults { + results: StringResult[]; +} + +export interface UpdateUserSecretArg { + UpsertSecretArg: UpsertSecretArg; + "auto-prune"?: boolean; + content?: SecretContentParams; + description?: string; + "existing-label": string; + "expire-time"?: string; + label?: string; + params?: AdditionalProperties; + "rotate-policy"?: string; + uri: string; +} + +export interface UpdateUserSecretArgs { + args: UpdateUserSecretArg[]; +} + +export interface UpsertSecretArg { + content: SecretContentParams; + description: string; + "expire-time": string; + label: string; + params: AdditionalProperties; + "rotate-policy": string; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + SecretsAPI is the backend for the Secrets facade. +*/ +class SecretsV2 implements Facade { + static NAME = "Secrets"; + static VERSION = 2; + + NAME = "Secrets"; + VERSION = 2; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + CreateSecrets creates new secrets. + */ + createSecrets(params: CreateSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "CreateSecrets", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GrantSecret grants access to a user secret. + */ + grantSecret(params: GrantRevokeUserSecretArg): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "GrantSecret", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ListSecrets lists available secrets. + */ + listSecrets(params: ListSecretsArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "ListSecrets", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RemoveSecrets remove user secret. + */ + removeSecrets(params: DeleteSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "RemoveSecrets", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RevokeSecret revokes access to a user secret. + */ + revokeSecret(params: GrantRevokeUserSecretArg): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "RevokeSecret", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UpdateSecrets creates new secrets. + */ + updateSecrets(params: UpdateUserSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Secrets", + request: "UpdateSecrets", + version: 2, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default SecretsV2; diff --git a/api/facades/secrets/index.ts b/api/facades/secrets/index.ts index 26eab6e26..da9ee8770 100644 --- a/api/facades/secrets/index.ts +++ b/api/facades/secrets/index.ts @@ -1,11 +1,13 @@ import { GenericFacade } from "../../types"; import SecretsV1 from "./SecretsV1.js"; +import SecretsV2 from "./SecretsV2.js"; export * as SecretsV1 from "./SecretsV1.js"; +export * as SecretsV2 from "./SecretsV2.js"; const Secrets: GenericFacade = { name: "Secrets", - versions: [SecretsV1], + versions: [SecretsV1, SecretsV2], }; export default Secrets; diff --git a/api/facades/uniter/UniterV19.ts b/api/facades/uniter/UniterV19.ts new file mode 100644 index 000000000..2ffe3c738 --- /dev/null +++ b/api/facades/uniter/UniterV19.ts @@ -0,0 +1,2693 @@ +/** + Juju Uniter version 19. + This facade is available on: + Controller-machine-agent + Machine-agent + Unit-agent + Models + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface APIHostPortsResult { + servers: HostPort[][]; +} + +export interface AccessInfo { + role: string; + "scope-tag": string; + "target-tag": string; +} + +export interface Action { + "execution-group"?: string; + name: string; + parallel?: boolean; + parameters?: AdditionalProperties; + receiver: string; + tag: string; +} + +export interface ActionExecutionResult { + "action-tag": string; + message?: string; + results?: AdditionalProperties; + status: string; +} + +export interface ActionExecutionResults { + results: ActionExecutionResult[]; +} + +export interface ActionMessage { + message: string; + timestamp: string; +} + +export interface ActionMessageParams { + messages: EntityString[]; +} + +export interface ActionResult { + action: Action; + completed: string; + enqueued: string; + error: Error; + log: ActionMessage[]; + message: string; + output: AdditionalProperties; + started: string; + status: string; +} + +export interface ActionResults { + results: ActionResult[]; +} + +export interface Address { + cidr?: string; + "config-type"?: string; + "is-secondary"?: boolean; + scope: string; + "space-id"?: string; + "space-name"?: string; + type: string; + value: string; +} + +export interface ApplicationStatusResult { + application: StatusResult; + error?: Error; + units: Record; +} + +export interface ApplicationStatusResults { + results: ApplicationStatusResult[]; +} + +export interface BoolResult { + error?: Error; + result: boolean; +} + +export interface BoolResults { + results: BoolResult[]; +} + +export interface CharmRelation { + interface: string; + limit: number; + name: string; + optional: boolean; + role: string; + scope: string; +} + +export interface CharmURL { + url: string; +} + +export interface CharmURLs { + urls: CharmURL[]; +} + +export interface CloudCredential { + attrs?: Record; + "auth-type": string; + redacted?: string[]; +} + +export interface CloudSpec { + cacertificates?: string[]; + credential?: CloudCredential; + endpoint?: string; + "identity-endpoint"?: string; + "is-controller-cloud"?: boolean; + name: string; + region?: string; + "skip-tls-verify"?: boolean; + "storage-endpoint"?: string; + type: string; +} + +export interface CloudSpecResult { + error: Error; + result: CloudSpec; +} + +export interface CommitHookChangesArg { + "add-storage"?: StorageAddParams[]; + "close-ports"?: EntityPortRange[]; + "open-ports"?: EntityPortRange[]; + "pod-spec"?: PodSpec; + "relation-unit-settings"?: RelationUnitSettings[]; + "secret-creates"?: CreateSecretArg[]; + "secret-deletes"?: DeleteSecretArg[]; + "secret-grants"?: GrantRevokeSecretArg[]; + "secret-revokes"?: GrantRevokeSecretArg[]; + "secret-track-latest"?: string[]; + "secret-updates"?: UpdateSecretArg[]; + "set-raw-k8s-spec"?: PodSpec; + tag: string; + "unit-state"?: SetUnitStateArg; + "update-network-info": boolean; +} + +export interface CommitHookChangesArgs { + args: CommitHookChangesArg[]; +} + +export interface ConfigSettingsResult { + error?: Error; + settings: AdditionalProperties; +} + +export interface ConfigSettingsResults { + results: ConfigSettingsResult[]; +} + +export interface CreateSecretArg { + UpsertSecretArg: UpsertSecretArg; + content?: SecretContentParams; + description?: string; + "expire-time"?: string; + label?: string; + "owner-tag": string; + params?: AdditionalProperties; + "rotate-policy"?: string; + uri?: string; +} + +export interface CreateSecretArgs { + args: CreateSecretArg[]; +} + +export interface CreateSecretURIsArg { + count: number; +} + +export interface DeleteSecretArg { + label: string; + revisions?: number[]; + uri: string; +} + +export interface DeleteSecretArgs { + args: DeleteSecretArg[]; +} + +export interface Endpoint { + "application-name": string; + relation: CharmRelation; +} + +export interface Entities { + entities: Entity[]; +} + +export interface EntitiesCharmURL { + entities: EntityCharmURL[]; +} + +export interface Entity { + tag: string; +} + +export interface EntityCharmURL { + "charm-url": string; + tag: string; +} + +export interface EntityPortRange { + endpoint: string; + "from-port": number; + protocol: string; + tag: string; + "to-port": number; +} + +export interface EntityStatusArgs { + data: AdditionalProperties; + info: string; + status: string; + tag: string; +} + +export interface EntityString { + tag: string; + value: string; +} + +export interface EntityWorkloadVersion { + tag: string; + "workload-version": string; +} + +export interface EntityWorkloadVersions { + entities: EntityWorkloadVersion[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface GetLeadershipSettingsBulkResults { + results: GetLeadershipSettingsResult[]; +} + +export interface GetLeadershipSettingsResult { + error?: Error; + settings: Record; +} + +export interface GetSecretConsumerInfoArgs { + "consumer-tag": string; + uris: string[]; +} + +export interface GetSecretContentArg { + label?: string; + peek?: boolean; + refresh?: boolean; + uri: string; +} + +export interface GetSecretContentArgs { + args: GetSecretContentArg[]; +} + +export interface GoalState { + relations: Record>; + units: Record; +} + +export interface GoalStateResult { + error: Error; + result: GoalState; +} + +export interface GoalStateResults { + results: GoalStateResult[]; +} + +export interface GoalStateStatus { + since: string; + status: string; +} + +export interface GrantRevokeSecretArg { + role: string; + "scope-tag": string; + "subject-tags": string[]; + uri: string; +} + +export interface GrantRevokeSecretArgs { + args: GrantRevokeSecretArg[]; +} + +export interface HostPort { + Address: Address; + cidr?: string; + "config-type"?: string; + "is-secondary"?: boolean; + port: number; + scope: string; + "space-id"?: string; + "space-name"?: string; + type: string; + value: string; +} + +export interface IntResult { + error?: Error; + result: number; +} + +export interface IntResults { + results: IntResult[]; +} + +export interface InterfaceAddress { + cidr: string; + hostname: string; + value: string; +} + +export interface LifeResult { + error?: Error; + life: string; +} + +export interface LifeResults { + results: LifeResult[]; +} + +export interface ListSecretResult { + access?: AccessInfo[]; + "create-time": string; + description?: string; + label?: string; + "latest-expire-time"?: string; + "latest-revision": number; + "next-rotate-time"?: string; + "owner-tag": string; + revisions: SecretRevision[]; + "rotate-policy"?: string; + "update-time": string; + uri: string; + value?: SecretValueResult; + version: number; +} + +export interface ListSecretResults { + results: ListSecretResult[]; +} + +export interface MergeLeadershipSettingsBulkParams { + params: MergeLeadershipSettingsParam[]; +} + +export interface MergeLeadershipSettingsParam { + "application-tag"?: string; + settings: Record; + "unit-tag"?: string; +} + +export interface MeterStatusResult { + code: string; + error?: Error; + info: string; +} + +export interface MeterStatusResults { + results: MeterStatusResult[]; +} + +export interface Metric { + key: string; + labels?: Record; + time: string; + value: string; +} + +export interface MetricBatch { + "charm-url": string; + created: string; + metrics: Metric[]; + uuid: string; +} + +export interface MetricBatchParam { + batch: MetricBatch; + tag: string; +} + +export interface MetricBatchParams { + batches: MetricBatchParam[]; +} + +export interface ModelConfigResult { + config: AdditionalProperties; +} + +export interface ModelResult { + error?: Error; + name: string; + type: string; + uuid: string; +} + +export interface NetworkInfo { + addresses: InterfaceAddress[]; + "interface-name": string; + "mac-address": string; +} + +export interface NetworkInfoParams { + bindings: string[]; + "relation-id"?: number; + unit: string; +} + +export interface NetworkInfoResult { + "bind-addresses": NetworkInfo[]; + "egress-subnets": string[]; + error: Error; + "ingress-addresses": string[]; +} + +export interface NetworkInfoResults { + results: Record; +} + +export interface NotifyWatchResult { + NotifyWatcherId: string; + error?: Error; +} + +export interface NotifyWatchResults { + results: NotifyWatchResult[]; +} + +export interface OpenPortRangesByEndpointResult { + error?: Error; + "unit-port-ranges": Record; +} + +export interface OpenPortRangesByEndpointResults { + results: OpenPortRangesByEndpointResult[]; +} + +export interface OpenUnitPortRangesByEndpoint { + endpoint: string; + "port-ranges": PortRange[]; +} + +export interface PodSpec { + spec?: string; + tag: string; +} + +export interface PortRange { + "from-port": number; + protocol: string; + "to-port": number; +} + +export interface RelationIds { + "relation-ids": number[]; +} + +export interface RelationResult { + bool?: boolean; + endpoint: Endpoint; + error?: Error; + id: number; + key: string; + life: string; + "other-application"?: string; +} + +export interface RelationResults { + results: RelationResult[]; +} + +export interface RelationStatusArg { + message: string; + "relation-id": number; + status: string; + "unit-tag": string; +} + +export interface RelationStatusArgs { + args: RelationStatusArg[]; +} + +export interface RelationUnit { + relation: string; + unit: string; +} + +export interface RelationUnitPair { + "local-unit": string; + relation: string; + "remote-unit": string; +} + +export interface RelationUnitPairs { + "relation-unit-pairs": RelationUnitPair[]; +} + +export interface RelationUnitSettings { + "application-settings": Record; + relation: string; + settings: Record; + unit: string; +} + +export interface RelationUnitStatus { + "in-scope": boolean; + "relation-tag": string; + suspended: boolean; +} + +export interface RelationUnitStatusResult { + error?: Error; + results: RelationUnitStatus[]; +} + +export interface RelationUnitStatusResults { + results: RelationUnitStatusResult[]; +} + +export interface RelationUnits { + "relation-units": RelationUnit[]; +} + +export interface RelationUnitsChange { + "app-changed"?: Record; + changed: Record; + departed?: string[]; +} + +export interface RelationUnitsWatchResult { + changes: RelationUnitsChange; + error?: Error; + "watcher-id": string; +} + +export interface RelationUnitsWatchResults { + results: RelationUnitsWatchResult[]; +} + +export interface ResolvedModeResult { + error?: Error; + mode: string; +} + +export interface ResolvedModeResults { + results: ResolvedModeResult[]; +} + +export interface SecretBackendArgs { + "backend-ids": string[]; + "for-drain": boolean; +} + +export interface SecretBackendConfig { + params?: AdditionalProperties; + type: string; +} + +export interface SecretBackendConfigResult { + config?: SecretBackendConfig; + draining: boolean; + "model-controller": string; + "model-name": string; + "model-uuid": string; +} + +export interface SecretBackendConfigResults { + "active-id": string; + results?: Record; +} + +export interface SecretConsumerInfoResult { + error?: Error; + label: string; + revision: number; +} + +export interface SecretConsumerInfoResults { + results: SecretConsumerInfoResult[]; +} + +export interface SecretContentParams { + data: Record; + "value-ref": SecretValueRef; +} + +export interface SecretContentResult { + "backend-config"?: SecretBackendConfigResult; + content: SecretContentParams; + error?: Error; + "latest-revision"?: number; +} + +export interface SecretContentResults { + results: SecretContentResult[]; +} + +export interface SecretRevision { + "backend-name"?: string; + "create-time"?: string; + "expire-time"?: string; + revision: number; + "update-time"?: string; + "value-ref"?: SecretValueRef; +} + +export interface SecretRevisionArg { + "pending-delete": boolean; + revisions: number[]; + uri: string; +} + +export interface SecretRotatedArg { + "original-revision": number; + skip: boolean; + uri: string; +} + +export interface SecretRotatedArgs { + args: SecretRotatedArg[]; +} + +export interface SecretTriggerChange { + "next-trigger-time": string; + revision?: number; + uri: string; +} + +export interface SecretTriggerWatchResult { + changes: SecretTriggerChange[]; + error?: Error; + "watcher-id": string; +} + +export interface SecretValueRef { + "backend-id": string; + "revision-id": string; +} + +export interface SecretValueResult { + data: Record; + error: Error; +} + +export interface SetStatus { + entities: EntityStatusArgs[]; +} + +export interface SetUnitStateArg { + "charm-state"?: Record; + "meter-status-state"?: string; + "relation-state"?: Record; + "secret-state"?: string; + "storage-state"?: string; + tag: string; + "uniter-state"?: string; +} + +export interface SetUnitStateArgs { + args: SetUnitStateArg[]; +} + +export interface SettingsResult { + error?: Error; + settings: Record; +} + +export interface SettingsResults { + results: SettingsResult[]; +} + +export interface StatusResult { + data: AdditionalProperties; + error?: Error; + id: string; + info: string; + life: string; + since: string; + status: string; +} + +export interface StatusResults { + results: StatusResult[]; +} + +export interface StorageAddParams { + name: string; + storage: StorageConstraints; + unit: string; +} + +export interface StorageAttachment { + kind: number; + life: string; + location: string; + "owner-tag": string; + "storage-tag": string; + "unit-tag": string; +} + +export interface StorageAttachmentId { + "storage-tag": string; + "unit-tag": string; +} + +export interface StorageAttachmentIds { + ids: StorageAttachmentId[]; +} + +export interface StorageAttachmentIdsResult { + error?: Error; + result: StorageAttachmentIds; +} + +export interface StorageAttachmentIdsResults { + results: StorageAttachmentIdsResult[]; +} + +export interface StorageAttachmentResult { + error?: Error; + result: StorageAttachment; +} + +export interface StorageAttachmentResults { + results: StorageAttachmentResult[]; +} + +export interface StorageConstraints { + count: number; + pool: string; + size: number; +} + +export interface StringBoolResult { + error?: Error; + ok: boolean; + result: string; +} + +export interface StringBoolResults { + results: StringBoolResult[]; +} + +export interface StringResult { + error?: Error; + result: string; +} + +export interface StringResults { + results: StringResult[]; +} + +export interface StringsResult { + error: Error; + result: string[]; +} + +export interface StringsWatchResult { + changes?: string[]; + error?: Error; + "watcher-id": string; +} + +export interface StringsWatchResults { + results: StringsWatchResult[]; +} + +export interface UnitRefreshResult { + Error: Error; + Life: string; + Resolved: string; + "provider-id"?: string; +} + +export interface UnitRefreshResults { + Results: UnitRefreshResult[]; +} + +export interface UnitSettings { + version: number; +} + +export interface UnitStateResult { + "charm-state": Record; + error: Error; + "meter-status-state": string; + "relation-state": Record; + "secret-state": string; + "storage-state": string; + "uniter-state": string; +} + +export interface UnitStateResults { + results: UnitStateResult[]; +} + +export interface UpdateSecretArg { + UpsertSecretArg: UpsertSecretArg; + content?: SecretContentParams; + description?: string; + "expire-time"?: string; + label?: string; + params?: AdditionalProperties; + "rotate-policy"?: string; + uri: string; +} + +export interface UpdateSecretArgs { + args: UpdateSecretArg[]; +} + +export interface UpgradeSeriesStatusParam { + entity: Entity; + message: string; + status: string; +} + +export interface UpgradeSeriesStatusParams { + params: UpgradeSeriesStatusParam[]; +} + +export interface UpgradeSeriesStatusResult { + error: Error; + status: string; + target: string; +} + +export interface UpgradeSeriesStatusResults { + results: UpgradeSeriesStatusResult[]; +} + +export interface UpsertSecretArg { + content: SecretContentParams; + description: string; + "expire-time": string; + label: string; + params: AdditionalProperties; + "rotate-policy": string; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + UniterAPI implements the latest version (v18) of the Uniter API. +*/ +class UniterV19 implements Facade { + static NAME = "Uniter"; + static VERSION = 19; + + NAME = "Uniter"; + VERSION = 19; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + APIAddresses returns the list of addresses used to connect to the API. + */ + aPIAddresses(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "APIAddresses", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + APIHostPorts returns the API server addresses. + */ + aPIHostPorts(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "APIHostPorts", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ActionStatus returns the status of Actions by Tags passed in. + */ + actionStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ActionStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Actions returns the Actions by Tags passed and ensures that the Unit asking + for them is the same Unit that has the Actions. + */ + actions(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Actions", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + AddMetricBatches adds the metrics for the specified unit. + */ + addMetricBatches(params: MetricBatchParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "AddMetricBatches", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ApplicationStatus returns the status of the Applications and its workloads + if the given unit is the leader. + */ + applicationStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ApplicationStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + AssignedMachine returns the machine tag for each given unit tag, or + an error satisfying params.IsCodeNotAssigned when a unit has no + assigned machine. + */ + assignedMachine(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "AssignedMachine", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + AvailabilityZone returns the availability zone for each given unit, if applicable. + */ + availabilityZone(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "AvailabilityZone", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + BeginActions marks the actions represented by the passed in Tags as running. + */ + beginActions(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "BeginActions", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CanApplyLXDProfile is a shim to call the LXDProfileAPIv2 version of this method. + */ + canApplyLXDProfile(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CanApplyLXDProfile", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmArchiveSha256 returns the SHA256 digest of the charm archive + (bundle) data for each charm url in the given parameters. + */ + charmArchiveSha256(params: CharmURLs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CharmArchiveSha256", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmModifiedVersion returns the most CharmModifiedVersion for all given + units or applications. + */ + charmModifiedVersion(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CharmModifiedVersion", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CharmURL returns the charm URL for all given units or applications. + */ + charmURL(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CharmURL", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ClearResolved removes any resolved setting from each given unit. + */ + clearResolved(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ClearResolved", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CloudAPIVersion returns the cloud API version, if available. + */ + cloudAPIVersion(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CloudAPIVersion", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CloudSpec returns the cloud spec used by the model in which the + authenticated unit or application resides. + A check is made beforehand to ensure that the request is made by an entity + that has been granted the appropriate trust. + */ + cloudSpec(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CloudSpec", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CommitHookChanges batches together all required API calls for applying + a set of changes after a hook successfully completes and executes them in a + single transaction. + */ + commitHookChanges(params: CommitHookChangesArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CommitHookChanges", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ConfigSettings returns the complete set of application charm config + settings available to each given unit. + */ + configSettings(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ConfigSettings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CreateSecretURIs creates new secret URIs. + */ + createSecretURIs(params: CreateSecretURIsArg): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CreateSecretURIs", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CreateSecrets creates new secrets. + */ + createSecrets(params: CreateSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CreateSecrets", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + CurrentModel returns the name and UUID for the current juju model. + */ + currentModel(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "CurrentModel", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Destroy advances all given Alive units' lifecycles as far as + possible. See state/Unit.Destroy(). + */ + destroy(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Destroy", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyAllSubordinates destroys all subordinates of each given unit. + */ + destroyAllSubordinates(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "DestroyAllSubordinates", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + DestroyUnitStorageAttachments marks each storage attachment of the + specified units as Dying. + */ + destroyUnitStorageAttachments(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "DestroyUnitStorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + EnsureDead calls EnsureDead on each given entity from state. It + will fail if the entity is not present. If it's Alive, nothing will + happen (see state/EnsureDead() for units or machines). + */ + ensureDead(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "EnsureDead", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + EnterScope ensures each unit has entered its scope in the relation, + for all of the given relation/unit pairs. See also + state.RelationUnit.EnterScope(). + */ + enterScope(params: RelationUnits): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "EnterScope", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + FinishActions saves the result of a completed Action + */ + finishActions(params: ActionExecutionResults): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "FinishActions", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetConsumerSecretsRevisionInfo returns the latest secret revisions for the specified secrets. + This facade method is used for remote watcher to get the latest secret revisions and labels for a secret changed hook. + */ + getConsumerSecretsRevisionInfo( + params: GetSecretConsumerInfoArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetConsumerSecretsRevisionInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + + */ + getMeterStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetMeterStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetPodSpec gets the pod specs for a set of applications. + */ + getPodSpec(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetPodSpec", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetPrincipal returns the result of calling PrincipalName() and + converting it to a tag, on each given unit. + */ + getPrincipal(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetPrincipal", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetRawK8sSpec gets the raw k8s specs for a set of applications. + */ + getRawK8sSpec(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetRawK8sSpec", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretBackendConfigs gets the config needed to create a client to secret backends. + */ + getSecretBackendConfigs( + params: SecretBackendArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetSecretBackendConfigs", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretContentInfo returns the secret values for the specified secrets. + */ + getSecretContentInfo( + params: GetSecretContentArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetSecretContentInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretMetadata returns metadata for the caller's secrets. + */ + getSecretMetadata(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetSecretMetadata", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretRevisionContentInfo returns the secret values for the specified secret revisions. + */ + getSecretRevisionContentInfo( + params: SecretRevisionArg + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GetSecretRevisionContentInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GoalStates returns information of charm units and relations. + */ + goalStates(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "GoalStates", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + HasSubordinates returns the whether each given unit has any subordinates. + */ + hasSubordinates(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "HasSubordinates", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + LXDProfileName is a shim to call the LXDProfileAPIv2 version of this method. + */ + lXDProfileName(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "LXDProfileName", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + LXDProfileRequired is a shim to call the LXDProfileAPIv2 version of this method. + */ + lXDProfileRequired(params: CharmURLs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "LXDProfileRequired", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + LeaveScope signals each unit has left its scope in the relation, + for all of the given relation/unit pairs. See also + state.RelationUnit.LeaveScope(). + */ + leaveScope(params: RelationUnits): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "LeaveScope", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Life returns the life status of every supplied entity, where available. + */ + life(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Life", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + LogActionsMessages records the log messages against the specified actions. + */ + logActionsMessages(params: ActionMessageParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "LogActionsMessages", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Merge merges in the provided leadership settings. Only leaders for + the given service may perform this operation. + */ + merge(params: MergeLeadershipSettingsBulkParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Merge", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ModelConfig returns the current model's configuration. + */ + modelConfig(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ModelConfig", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + NetworkInfo returns network interfaces/addresses for specified bindings. + */ + networkInfo(params: NetworkInfoParams): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "NetworkInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + OpenedMachinePortRangesByEndpoint returns the port ranges opened by each + unit on the provided machines grouped by application endpoint. + */ + openedMachinePortRangesByEndpoint( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "OpenedMachinePortRangesByEndpoint", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + OpenedPortRangesByEndpoint returns the port ranges opened by the unit. + */ + openedPortRangesByEndpoint( + params: any + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "OpenedPortRangesByEndpoint", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + PrivateAddress returns the private address for each given unit, if set. + */ + privateAddress(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "PrivateAddress", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ProviderType returns the provider type used by the current juju + model. + + TODO(dimitern): Refactor the uniter to call this instead of calling + ModelConfig() just to get the provider type. Once we have machine + addresses, this might be completely unnecessary though. + */ + providerType(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ProviderType", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + PublicAddress returns the public address for each given unit, if set. + */ + publicAddress(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "PublicAddress", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Read reads leadership settings for the provided service ID. Any + unit of the service may perform this operation. + */ + read(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Read", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ReadLocalApplicationSettings returns the local application settings for a + particular relation when invoked by the leader unit. + */ + readLocalApplicationSettings(params: RelationUnit): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ReadLocalApplicationSettings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ReadRemoteSettings returns the remote settings of each given set of + relation/local unit/remote unit. + */ + readRemoteSettings(params: RelationUnitPairs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ReadRemoteSettings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + ReadSettings returns the local settings of each given set of + relation/unit. + + NOTE(achilleasa): Using this call to read application data is deprecated + and will not work for k8s charms (see LP1876097). Instead, clients should + use ReadLocalApplicationSettings. + */ + readSettings(params: RelationUnits): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "ReadSettings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Refresh retrieves the latest values for attributes on this unit. + */ + refresh(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Refresh", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Relation returns information about all given relation/unit pairs, + including their id, key and the local endpoint. + */ + relation(params: RelationUnits): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Relation", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RelationById returns information about all given relations, + specified by their ids, including their key and the local + endpoint. + */ + relationById(params: RelationIds): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "RelationById", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RelationsStatus returns for each unit the corresponding relation and status information. + */ + relationsStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "RelationsStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RemoveSecrets removes the specified secrets. + */ + removeSecrets(params: DeleteSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "RemoveSecrets", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RemoveStorageAttachments removes the specified storage + attachments from state. + */ + removeStorageAttachments( + params: StorageAttachmentIds + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "RemoveStorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + RequestReboot sets the reboot flag on the provided machines + */ + requestReboot(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "RequestReboot", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Resolved returns the current resolved setting for each given unit. + */ + resolved(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Resolved", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SLALevel returns the model's SLA level. + */ + sLALevel(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SLALevel", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SecretsGrant grants access to a secret for the specified subjects. + */ + secretsGrant(params: GrantRevokeSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SecretsGrant", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SecretsRevoke revokes access to a secret for the specified subjects. + */ + secretsRevoke(params: GrantRevokeSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SecretsRevoke", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SecretsRotated records when secrets were last rotated. + */ + secretsRotated(params: SecretRotatedArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SecretsRotated", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetAgentStatus will set status for agents of Units passed in args, if one + of the args is not an Unit it will fail. + */ + setAgentStatus(params: SetStatus): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetAgentStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetApplicationStatus sets the status for all the Applications in args if the given Unit is + the leader. + */ + setApplicationStatus(params: SetStatus): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetApplicationStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetCharmURL sets the charm URL for each given unit. An error will + be returned if a unit is dead, or the charm URL is not known. + */ + setCharmURL(params: EntitiesCharmURL): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetCharmURL", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetRelationStatus updates the status of the specified relations. + */ + setRelationStatus(params: RelationStatusArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetRelationStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetState sets the state persisted by the charm running in this unit + and the state internal to the uniter for this unit. + */ + setState(params: SetUnitStateArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetState", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetStatus will set status for a entities passed in args. If the entity is + a Unit it will instead set status to its agent, to emulate backwards + compatibility. + */ + setStatus(params: SetStatus): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetUnitStatus sets status for all elements passed in args, the difference + with SetStatus is that if an entity is a Unit it will set its status instead + of its agent. + */ + setUnitStatus(params: SetStatus): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetUnitStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetUpgradeSeriesUnitStatus sets the upgrade series status of the unit. + If no upgrade is in progress an error is returned instead. + */ + setUpgradeSeriesUnitStatus( + params: UpgradeSeriesStatusParams + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetUpgradeSeriesUnitStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + SetWorkloadVersion sets the workload version for each given unit. An error will + be returned if a unit is dead. + */ + setWorkloadVersion(params: EntityWorkloadVersions): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "SetWorkloadVersion", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + State returns the state persisted by the charm running in this unit + and the state internal to the uniter for this unit. + */ + state(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "State", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + StorageAttachmentLife returns the lifecycle state of the storage attachments + with the specified tags. + */ + storageAttachmentLife(params: StorageAttachmentIds): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "StorageAttachmentLife", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + StorageAttachments returns the storage attachments with the specified tags. + */ + storageAttachments( + params: StorageAttachmentIds + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "StorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UnitStatus returns the workload status information for the unit. + */ + unitStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "UnitStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UnitStorageAttachments returns the IDs of storage attachments for a collection of units. + */ + unitStorageAttachments( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "UnitStorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UpdateNetworkInfo refreshes the network settings for a unit's bound + endpoints. + */ + updateNetworkInfo(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "UpdateNetworkInfo", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UpdateSecrets updates the specified secrets. + */ + updateSecrets(params: UpdateSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "UpdateSecrets", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + UpgradeSeriesUnitStatus returns the current preparation status of an + upgrading unit. + If no series upgrade is in progress an error is returned instead. + */ + upgradeSeriesUnitStatus( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "UpgradeSeriesUnitStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + Watch starts an NotifyWatcher for each given entity. + */ + watch(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "Watch", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchAPIHostPorts watches the API server addresses. + */ + watchAPIHostPorts(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchAPIHostPorts", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchActionNotifications returns a StringsWatcher for observing + incoming action calls to a unit. See also state/watcher.go + Unit.WatchActionNotifications(). This method is called from + api/uniter/uniter.go WatchActionNotifications(). + */ + watchActionNotifications(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchActionNotifications", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchConfigSettingsHash returns a StringsWatcher that yields a hash + of the config values every time the config changes. The uniter can + save this hash and use it to decide whether the config-changed hook + needs to be run (or whether this was just an agent restart with no + substantive config change). + */ + watchConfigSettingsHash(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchConfigSettingsHash", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchConsumedSecretsChanges sets up a watcher to notify of changes to secret revisions for the specified consumers. + */ + watchConsumedSecretsChanges(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchConsumedSecretsChanges", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchForModelConfigChanges returns a NotifyWatcher that observes + changes to the model configuration. + Note that although the NotifyWatchResult contains an Error field, + it's not used because we are only returning a single watcher, + so we use the regular error return. + */ + watchForModelConfigChanges(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchForModelConfigChanges", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchInstanceData is a shim to call the LXDProfileAPIv2 version of this method. + */ + watchInstanceData(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchInstanceData", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchLeadershipSettings will block the caller until leadership settings + for the given service ID change. + */ + watchLeadershipSettings(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchLeadershipSettings", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + + */ + watchMeterStatus(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchMeterStatus", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchObsolete returns a watcher for notifying when: + - a secret owned by the entity is deleted + - a secret revision owed by the entity no longer + has any consumers + + Obsolete revisions results are "uri/revno" and deleted + secret results are "uri". + */ + watchObsolete(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchObsolete", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchRelationUnits returns a RelationUnitsWatcher for observing + changes to every unit in the supplied relation that is visible to + the supplied unit. See also state/watcher.go:RelationUnit.Watch(). + */ + watchRelationUnits( + params: RelationUnits + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchRelationUnits", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchSecretRevisionsExpiryChanges sets up a watcher to notify of changes to secret revision expiry config. + */ + watchSecretRevisionsExpiryChanges( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchSecretRevisionsExpiryChanges", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchSecretsRotationChanges sets up a watcher to notify of changes to secret rotation config. + */ + watchSecretsRotationChanges( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchSecretsRotationChanges", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchStorageAttachments creates watchers for a collection of storage + attachments, each of which can be used to watch changes to storage + attachment info. + */ + watchStorageAttachments( + params: StorageAttachmentIds + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchStorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchTrustConfigSettingsHash returns a StringsWatcher that yields a + hash of the application config values whenever they change. The + uniter can use the hash to determine whether the actual values have + changed since it last saw the config. + */ + watchTrustConfigSettingsHash(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchTrustConfigSettingsHash", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchUnitAddressesHash returns a StringsWatcher that yields the + hashes of the addresses for the unit whenever the addresses + change. The uniter can use the hash to determine whether the actual + address values have changed since it last saw the config. + */ + watchUnitAddressesHash(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchUnitAddressesHash", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchUnitRelations returns a StringsWatcher, for each given + unit, that notifies of changes to the lifecycles of relations + relevant to that unit. For principal units, this will be all of the + relations for the application. For subordinate units, only + relations with the principal unit's application will be monitored. + */ + watchUnitRelations(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchUnitRelations", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchUnitStorageAttachments creates watchers for a collection of units, + each of which can be used to watch for lifecycle changes to the corresponding + unit's storage attachments. + */ + watchUnitStorageAttachments(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchUnitStorageAttachments", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchUpgradeSeriesNotifications returns a NotifyWatcher for observing changes to upgrade series locks. + */ + watchUpgradeSeriesNotifications( + params: Entities + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WatchUpgradeSeriesNotifications", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WorkloadVersion returns the workload version for all given units or applications. + */ + workloadVersion(params: Entities): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "Uniter", + request: "WorkloadVersion", + version: 19, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default UniterV19; diff --git a/api/facades/uniter/index.ts b/api/facades/uniter/index.ts index ed6d3f869..624a7322a 100644 --- a/api/facades/uniter/index.ts +++ b/api/facades/uniter/index.ts @@ -1,13 +1,15 @@ import { GenericFacade } from "../../types"; import UniterV16 from "./UniterV16.js"; import UniterV18 from "./UniterV18.js"; +import UniterV19 from "./UniterV19.js"; export * as UniterV16 from "./UniterV16.js"; export * as UniterV18 from "./UniterV18.js"; +export * as UniterV19 from "./UniterV19.js"; const Uniter: GenericFacade = { name: "Uniter", - versions: [UniterV16, UniterV18], + versions: [UniterV16, UniterV18, UniterV19], }; export default Uniter; diff --git a/api/facades/user-secrets-drain/UserSecretsDrainV1.ts b/api/facades/user-secrets-drain/UserSecretsDrainV1.ts new file mode 100644 index 000000000..45dc87b36 --- /dev/null +++ b/api/facades/user-secrets-drain/UserSecretsDrainV1.ts @@ -0,0 +1,274 @@ +/** + Juju UserSecretsDrain version 1. + This facade is available on: + Controller-machine-agent + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface AccessInfo { + role: string; + "scope-tag": string; + "target-tag": string; +} + +export interface ChangeSecretBackendArg { + content?: SecretContentParams; + revision: number; + uri: string; +} + +export interface ChangeSecretBackendArgs { + args: ChangeSecretBackendArg[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface GetSecretContentArg { + label?: string; + peek?: boolean; + refresh?: boolean; + uri: string; +} + +export interface GetSecretContentArgs { + args: GetSecretContentArg[]; +} + +export interface ListSecretResult { + access?: AccessInfo[]; + "create-time": string; + description?: string; + label?: string; + "latest-expire-time"?: string; + "latest-revision": number; + "next-rotate-time"?: string; + "owner-tag": string; + revisions: SecretRevision[]; + "rotate-policy"?: string; + "update-time": string; + uri: string; + value?: SecretValueResult; + version: number; +} + +export interface ListSecretResults { + results: ListSecretResult[]; +} + +export interface NotifyWatchResult { + NotifyWatcherId: string; + error?: Error; +} + +export interface SecretBackendArgs { + "backend-ids": string[]; + "for-drain": boolean; +} + +export interface SecretBackendConfig { + params?: AdditionalProperties; + type: string; +} + +export interface SecretBackendConfigResult { + config?: SecretBackendConfig; + draining: boolean; + "model-controller": string; + "model-name": string; + "model-uuid": string; +} + +export interface SecretBackendConfigResults { + "active-id": string; + results?: Record; +} + +export interface SecretContentParams { + data: Record; + "value-ref": SecretValueRef; +} + +export interface SecretContentResult { + "backend-config"?: SecretBackendConfigResult; + content: SecretContentParams; + error?: Error; + "latest-revision"?: number; +} + +export interface SecretContentResults { + results: SecretContentResult[]; +} + +export interface SecretRevision { + "backend-name"?: string; + "create-time"?: string; + "expire-time"?: string; + revision: number; + "update-time"?: string; + "value-ref"?: SecretValueRef; +} + +export interface SecretRevisionArg { + "pending-delete": boolean; + revisions: number[]; + uri: string; +} + +export interface SecretValueRef { + "backend-id": string; + "revision-id": string; +} + +export interface SecretValueResult { + data: Record; + error: Error; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + SecretsDrainAPI is the implementation for the SecretsDrain facade. +*/ +class UserSecretsDrainV1 implements Facade { + static NAME = "UserSecretsDrain"; + static VERSION = 1; + + NAME = "UserSecretsDrain"; + VERSION = 1; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + ChangeSecretBackend updates the backend for the specified secret after migration done. + */ + changeSecretBackend(params: ChangeSecretBackendArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "ChangeSecretBackend", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretBackendConfigs gets the config needed to create a client to secret backends for the drain worker. + */ + getSecretBackendConfigs( + params: SecretBackendArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "GetSecretBackendConfigs", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretContentInfo returns the secret values for the specified secrets. + */ + getSecretContentInfo( + params: GetSecretContentArgs + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "GetSecretContentInfo", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretRevisionContentInfo returns the secret values for the specified secret revisions. + */ + getSecretRevisionContentInfo( + params: SecretRevisionArg + ): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "GetSecretRevisionContentInfo", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + GetSecretsToDrain returns metadata for the secrets that need to be drained. + */ + getSecretsToDrain(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "GetSecretsToDrain", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchSecretBackendChanged sets up a watcher to notify of changes to the secret backend. + */ + watchSecretBackendChanged(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsDrain", + request: "WatchSecretBackendChanged", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default UserSecretsDrainV1; diff --git a/api/facades/user-secrets-drain/index.ts b/api/facades/user-secrets-drain/index.ts new file mode 100644 index 000000000..5ebf18d96 --- /dev/null +++ b/api/facades/user-secrets-drain/index.ts @@ -0,0 +1,11 @@ +import { GenericFacade } from "../../types"; +import UserSecretsDrainV1 from "./UserSecretsDrainV1.js"; + +export * as UserSecretsDrainV1 from "./UserSecretsDrainV1.js"; + +const UserSecretsDrain: GenericFacade = { + name: "UserSecretsDrain", + versions: [UserSecretsDrainV1], +}; + +export default UserSecretsDrain; diff --git a/api/facades/user-secrets-manager/UserSecretsManagerV1.ts b/api/facades/user-secrets-manager/UserSecretsManagerV1.ts new file mode 100644 index 000000000..0931a48bb --- /dev/null +++ b/api/facades/user-secrets-manager/UserSecretsManagerV1.ts @@ -0,0 +1,105 @@ +/** + Juju UserSecretsManager version 1. + This facade is available on: + Controller-machine-agent + + NOTE: This file was generated using the Juju schema + from Juju 3.3.2 at the git SHA 65fa4c1ee5. + Do not manually edit this file. +*/ + +import type { JujuRequest } from "../../../generator/interfaces.js"; +import { ConnectionInfo, Transport } from "../../client.js"; +import { Facade } from "../../types.js"; +import { autoBind } from "../../utils.js"; + +export interface DeleteSecretArg { + label: string; + revisions?: number[]; + uri: string; +} + +export interface DeleteSecretArgs { + args: DeleteSecretArg[]; +} + +export interface Error { + code: string; + info?: AdditionalProperties; + message: string; +} + +export interface ErrorResult { + error: Error; +} + +export interface ErrorResults { + results: ErrorResult[]; +} + +export interface StringsWatchResult { + changes?: string[]; + error?: Error; + "watcher-id": string; +} + +export interface AdditionalProperties { + [key: string]: any; +} + +/** + UserSecretsManager is the implementation for the usersecrets facade. +*/ +class UserSecretsManagerV1 implements Facade { + static NAME = "UserSecretsManager"; + static VERSION = 1; + + NAME = "UserSecretsManager"; + VERSION = 1; + + _transport: Transport; + _info: ConnectionInfo; + + constructor(transport: Transport, info: ConnectionInfo) { + this._transport = transport; + this._info = info; + + // Automatically bind all methods to instances. + autoBind(this); + } + /** + DeleteRevisions deletes the specified revisions of the specified secret. + */ + deleteRevisions(params: DeleteSecretArgs): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsManager", + request: "DeleteRevisions", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } + + /** + WatchRevisionsToPrune returns a watcher for notifying when: + - a secret revision owned by the model no longer + has any consumers and should be pruned. + */ + watchRevisionsToPrune(params: any): Promise { + return new Promise((resolve, reject) => { + const req: JujuRequest = { + type: "UserSecretsManager", + request: "WatchRevisionsToPrune", + version: 1, + params: params, + }; + + this._transport.write(req, resolve, reject); + }); + } +} + +export default UserSecretsManagerV1; diff --git a/api/facades/user-secrets-manager/index.ts b/api/facades/user-secrets-manager/index.ts new file mode 100644 index 000000000..1771ca617 --- /dev/null +++ b/api/facades/user-secrets-manager/index.ts @@ -0,0 +1,11 @@ +import { GenericFacade } from "../../types"; +import UserSecretsManagerV1 from "./UserSecretsManagerV1.js"; + +export * as UserSecretsManagerV1 from "./UserSecretsManagerV1.js"; + +const UserSecretsManager: GenericFacade = { + name: "UserSecretsManager", + versions: [UserSecretsManagerV1], +}; + +export default UserSecretsManager; diff --git a/generator/schema/juju-git-sha.txt b/generator/schema/juju-git-sha.txt index be8923f98..2f7e22e5e 100644 --- a/generator/schema/juju-git-sha.txt +++ b/generator/schema/juju-git-sha.txt @@ -1 +1 @@ -06eb3f6c7c \ No newline at end of file +65fa4c1ee5 \ No newline at end of file diff --git a/generator/schema/juju-version.txt b/generator/schema/juju-version.txt index 0444f3207..5436ea06e 100644 --- a/generator/schema/juju-version.txt +++ b/generator/schema/juju-version.txt @@ -1 +1 @@ -3.2.1 \ No newline at end of file +3.3.2 \ No newline at end of file diff --git a/generator/schema/schema.json b/generator/schema/schema.json index 9ec3136bf..a83bf72d7 100644 --- a/generator/schema/schema.json +++ b/generator/schema/schema.json @@ -1839,8 +1839,8 @@ }, { "Name": "Application", - "Description": "APIv18 provides the Application API facade for version 18.", - "Version": 18, + "Description": "APIv19 provides the Application API facade for version 19.", + "Version": 19, "AvailableTo": [ "controller-machine-agent", "machine-agent", @@ -2136,7 +2136,7 @@ "$ref": "#/definitions/ErrorResults" } }, - "description": "SetMetricCredentials sets credentials on the application." + "description": "SetMetricCredentials sets credentials on the application.\nTODO (cderici) only used for metered charms in cmd MeteredDeployAPI,\nkept for client compatibility, remove in juju 4.0" }, "SetRelationsSuspended": { "type": "object", @@ -3039,9 +3039,6 @@ "application-description": { "type": "string" }, - "auth-token": { - "type": "string" - }, "bindings": { "type": "object", "patternProperties": { @@ -3669,13 +3666,10 @@ }, "Type": { "type": "string" - }, - "pending-id": { - "type": "string" } }, "additionalProperties": false, - "required": ["Name", "Filename", "pending-id", "Type"] + "required": ["Name", "Filename", "Type"] }, "Placement": { "type": "object", @@ -4429,9 +4423,6 @@ "ConsumeOfferDetails": { "type": "object", "properties": { - "auth-token": { - "type": "string" - }, "external-controller": { "$ref": "#/definitions/ExternalControllerInfo" }, @@ -4463,9 +4454,6 @@ "ConsumeOfferDetails": { "$ref": "#/definitions/ConsumeOfferDetails" }, - "auth-token": { - "type": "string" - }, "error": { "$ref": "#/definitions/Error" }, @@ -5540,6 +5528,9 @@ "properties": { "include-charm-defaults": { "type": "boolean" + }, + "include-series": { + "type": "boolean" } }, "additionalProperties": false @@ -9687,6 +9678,14 @@ "$ref": "#/definitions/ControllerConfigResult" } } + }, + "WatchControllerConfig": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/NotifyWatchResult" + } + } } }, "definitions": { @@ -9705,6 +9704,41 @@ }, "additionalProperties": false, "required": ["config"] + }, + "Error": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "info": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "message": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["message", "code"] + }, + "NotifyWatchResult": { + "type": "object", + "properties": { + "NotifyWatcherId": { + "type": "string" + }, + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false, + "required": ["NotifyWatcherId"] } } } @@ -9778,6 +9812,15 @@ } }, "description": "WatchAPIHostPorts watches the API server addresses." + }, + "WatchModelOperatorProvisioningInfo": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/NotifyWatchResult" + } + }, + "description": "WatchModelOperatorProvisioningInfo provides a watcher for changes that affect the\ninformation returned by ModelOperatorProvisioningInfo." } }, "definitions": { @@ -13784,8 +13827,8 @@ }, { "Name": "Charms", - "Description": "APIv6 provides the Charms API facade for version 6.\nIt removes the AddCharmWithAuthorization function, as\nwe no longer support macaroons.", - "Version": 6, + "Description": "APIv7 provides the Charms API facade for version 7.\nv7 guarantees SupportedBases will be provided in ResolveCharms", + "Version": 7, "AvailableTo": ["model-user"], "Schema": { "type": "object", @@ -13848,7 +13891,7 @@ "$ref": "#/definitions/IsMeteredResult" } }, - "description": "IsMetered returns whether or not the charm is metered." + "description": "IsMetered returns whether or not the charm is metered.\nTODO (cderici) only used for metered charms in cmd MeteredDeployAPI,\nkept for client compatibility, remove in juju 4.0" }, "List": { "type": "object", @@ -14785,10 +14828,10 @@ "error": { "$ref": "#/definitions/Error" }, - "supported-series": { + "supported-bases": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/Base" } }, "url": { @@ -14796,7 +14839,7 @@ } }, "additionalProperties": false, - "required": ["url", "charm-origin", "supported-series"] + "required": ["url", "charm-origin", "supported-bases"] }, "ResolveCharmWithChannelResults": { "type": "object", @@ -14894,7 +14937,7 @@ { "Name": "Client", "Description": "Client serves client-specific API methods.", - "Version": 6, + "Version": 7, "AvailableTo": [ "controller-machine-agent", "machine-agent", @@ -15257,6 +15300,32 @@ "additionalProperties": false, "required": ["application", "name", "role", "subordinate"] }, + "EntityStatus": { + "type": "object", + "properties": { + "data": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "info": { + "type": "string" + }, + "since": { + "type": "string", + "format": "date-time" + }, + "status": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["status", "info", "since"] + }, "Error": { "type": "object", "properties": { @@ -15297,6 +15366,94 @@ }, "additionalProperties": false }, + "FilesystemAttachmentDetails": { + "type": "object", + "properties": { + "FilesystemAttachmentInfo": { + "$ref": "#/definitions/FilesystemAttachmentInfo" + }, + "life": { + "type": "string" + }, + "mount-point": { + "type": "string" + }, + "read-only": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": ["FilesystemAttachmentInfo"] + }, + "FilesystemAttachmentInfo": { + "type": "object", + "properties": { + "mount-point": { + "type": "string" + }, + "read-only": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "FilesystemDetails": { + "type": "object", + "properties": { + "filesystem-tag": { + "type": "string" + }, + "info": { + "$ref": "#/definitions/FilesystemInfo" + }, + "life": { + "type": "string" + }, + "machine-attachments": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/FilesystemAttachmentDetails" + } + } + }, + "status": { + "$ref": "#/definitions/EntityStatus" + }, + "storage": { + "$ref": "#/definitions/StorageDetails" + }, + "unit-attachments": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/FilesystemAttachmentDetails" + } + } + }, + "volume-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["filesystem-tag", "info", "status"] + }, + "FilesystemInfo": { + "type": "object", + "properties": { + "filesystem-id": { + "type": "string" + }, + "pool": { + "type": "string" + }, + "size": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": ["filesystem-id", "pool", "size"] + }, "FindToolsParams": { "type": "object", "properties": { @@ -15358,6 +15515,12 @@ "type": "string", "format": "date-time" }, + "filesystems": { + "type": "array", + "items": { + "$ref": "#/definitions/FilesystemDetails" + } + }, "machines": { "type": "object", "patternProperties": { @@ -15390,6 +15553,18 @@ "$ref": "#/definitions/RemoteApplicationStatus" } } + }, + "storage": { + "type": "array", + "items": { + "$ref": "#/definitions/StorageDetails" + } + }, + "volumes": { + "type": "array", + "items": { + "$ref": "#/definitions/VolumeDetails" + } } }, "additionalProperties": false, @@ -15837,6 +16012,9 @@ "StatusParams": { "type": "object", "properties": { + "include-storage": { + "type": "boolean" + }, "patterns": { "type": "array", "items": { @@ -15847,6 +16025,67 @@ "additionalProperties": false, "required": ["patterns"] }, + "StorageAttachmentDetails": { + "type": "object", + "properties": { + "life": { + "type": "string" + }, + "location": { + "type": "string" + }, + "machine-tag": { + "type": "string" + }, + "storage-tag": { + "type": "string" + }, + "unit-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["storage-tag", "unit-tag", "machine-tag"] + }, + "StorageDetails": { + "type": "object", + "properties": { + "attachments": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/StorageAttachmentDetails" + } + } + }, + "kind": { + "type": "integer" + }, + "life": { + "type": "string" + }, + "owner-tag": { + "type": "string" + }, + "persistent": { + "type": "boolean" + }, + "status": { + "$ref": "#/definitions/EntityStatus" + }, + "storage-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "storage-tag", + "owner-tag", + "kind", + "status", + "persistent" + ] + }, "Tools": { "type": "object", "properties": { @@ -15922,6 +16161,135 @@ "charm", "subordinates" ] + }, + "VolumeAttachmentDetails": { + "type": "object", + "properties": { + "VolumeAttachmentInfo": { + "$ref": "#/definitions/VolumeAttachmentInfo" + }, + "bus-address": { + "type": "string" + }, + "device-link": { + "type": "string" + }, + "device-name": { + "type": "string" + }, + "life": { + "type": "string" + }, + "plan-info": { + "$ref": "#/definitions/VolumeAttachmentPlanInfo" + }, + "read-only": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": ["VolumeAttachmentInfo"] + }, + "VolumeAttachmentInfo": { + "type": "object", + "properties": { + "bus-address": { + "type": "string" + }, + "device-link": { + "type": "string" + }, + "device-name": { + "type": "string" + }, + "plan-info": { + "$ref": "#/definitions/VolumeAttachmentPlanInfo" + }, + "read-only": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "VolumeAttachmentPlanInfo": { + "type": "object", + "properties": { + "device-attributes": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "device-type": { + "type": "string" + } + }, + "additionalProperties": false + }, + "VolumeDetails": { + "type": "object", + "properties": { + "info": { + "$ref": "#/definitions/VolumeInfo" + }, + "life": { + "type": "string" + }, + "machine-attachments": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/VolumeAttachmentDetails" + } + } + }, + "status": { + "$ref": "#/definitions/EntityStatus" + }, + "storage": { + "$ref": "#/definitions/StorageDetails" + }, + "unit-attachments": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/VolumeAttachmentDetails" + } + } + }, + "volume-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["volume-tag", "info", "status"] + }, + "VolumeInfo": { + "type": "object", + "properties": { + "hardware-id": { + "type": "string" + }, + "persistent": { + "type": "boolean" + }, + "pool": { + "type": "string" + }, + "size": { + "type": "integer" + }, + "volume-id": { + "type": "string" + }, + "wwn": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["volume-id", "size", "persistent"] } } } @@ -16611,9 +16979,6 @@ "cpu-cores": { "type": "integer" }, - "deprecated": { - "type": "boolean" - }, "memory": { "type": "integer" }, @@ -18768,9 +19133,6 @@ "application-token": { "type": "string" }, - "auth-token": { - "type": "string" - }, "bakery-version": { "type": "integer" }, @@ -25391,9 +25753,6 @@ "cpu-cores": { "type": "integer" }, - "deprecated": { - "type": "boolean" - }, "memory": { "type": "integer" }, @@ -27624,6 +27983,17 @@ "controller-agent-version": { "$ref": "#/definitions/Number" }, + "facade-versions": { + "type": "object", + "patternProperties": { + ".*": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "name": { "type": "string" }, @@ -28133,7 +28503,7 @@ { "Name": "MigrationTarget", "Description": "API implements the API required for the model migration\nmaster worker when communicating with the target controller.", - "Version": 2, + "Version": 3, "AvailableTo": ["controller-user"], "Schema": { "type": "object", @@ -28335,6 +28705,17 @@ "controller-agent-version": { "$ref": "#/definitions/Number" }, + "facade-versions": { + "type": "object", + "patternProperties": { + ".*": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "name": { "type": "string" }, @@ -36622,11 +37003,35 @@ { "Name": "Secrets", "Description": "SecretsAPI is the backend for the Secrets facade.", - "Version": 1, + "Version": 2, "AvailableTo": ["model-user"], "Schema": { "type": "object", "properties": { + "CreateSecrets": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/CreateSecretArgs" + }, + "Result": { + "$ref": "#/definitions/StringResults" + } + }, + "description": "CreateSecrets creates new secrets." + }, + "GrantSecret": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/GrantRevokeUserSecretArg" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "GrantSecret grants access to a user secret." + }, "ListSecrets": { "type": "object", "properties": { @@ -36638,9 +37043,147 @@ } }, "description": "ListSecrets lists available secrets." + }, + "RemoveSecrets": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/DeleteSecretArgs" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "RemoveSecrets remove user secret." + }, + "RevokeSecret": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/GrantRevokeUserSecretArg" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "RevokeSecret revokes access to a user secret." + }, + "UpdateSecrets": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/UpdateUserSecretArgs" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "UpdateSecrets creates new secrets." } }, "definitions": { + "AccessInfo": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "scope-tag": { + "type": "string" + }, + "target-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["target-tag", "scope-tag", "role"] + }, + "CreateSecretArg": { + "type": "object", + "properties": { + "UpsertSecretArg": { + "$ref": "#/definitions/UpsertSecretArg" + }, + "content": { + "$ref": "#/definitions/SecretContentParams" + }, + "description": { + "type": "string" + }, + "expire-time": { + "type": "string", + "format": "date-time" + }, + "label": { + "type": "string" + }, + "owner-tag": { + "type": "string" + }, + "params": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "rotate-policy": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["UpsertSecretArg", "owner-tag"] + }, + "CreateSecretArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/CreateSecretArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, + "DeleteSecretArg": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "revisions": { + "type": "array", + "items": { + "type": "integer" + } + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri", "label"] + }, + "DeleteSecretArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/DeleteSecretArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, "Error": { "type": "object", "properties": { @@ -36663,9 +37206,56 @@ "additionalProperties": false, "required": ["message", "code"] }, + "ErrorResult": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false + }, + "ErrorResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ErrorResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "GrantRevokeUserSecretArg": { + "type": "object", + "properties": { + "applications": { + "type": "array", + "items": { + "type": "string" + } + }, + "label": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri", "label", "applications"] + }, "ListSecretResult": { "type": "object", "properties": { + "access": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessInfo" + } + }, "create-time": { "type": "string", "format": "date-time" @@ -36750,6 +37340,23 @@ "additionalProperties": false, "required": ["show-secrets", "filter"] }, + "SecretContentParams": { + "type": "object", + "properties": { + "data": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "value-ref": { + "$ref": "#/definitions/SecretValueRef" + } + }, + "additionalProperties": false + }, "SecretRevision": { "type": "object", "properties": { @@ -36811,6 +37418,9 @@ "SecretsFilter": { "type": "object", "properties": { + "label": { + "type": "string" + }, "owner-tag": { "type": "string" }, @@ -36822,6 +37432,120 @@ } }, "additionalProperties": false + }, + "StringResult": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + }, + "result": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["result"] + }, + "StringResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/StringResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "UpdateUserSecretArg": { + "type": "object", + "properties": { + "UpsertSecretArg": { + "$ref": "#/definitions/UpsertSecretArg" + }, + "auto-prune": { + "type": "boolean" + }, + "content": { + "$ref": "#/definitions/SecretContentParams" + }, + "description": { + "type": "string" + }, + "existing-label": { + "type": "string" + }, + "expire-time": { + "type": "string", + "format": "date-time" + }, + "label": { + "type": "string" + }, + "params": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "rotate-policy": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["UpsertSecretArg", "uri", "existing-label"] + }, + "UpdateUserSecretArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/UpdateUserSecretArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, + "UpsertSecretArg": { + "type": "object", + "properties": { + "content": { + "$ref": "#/definitions/SecretContentParams" + }, + "description": { + "type": "string" + }, + "expire-time": { + "type": "string", + "format": "date-time" + }, + "label": { + "type": "string" + }, + "params": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "rotate-policy": { + "type": "string" + } + }, + "additionalProperties": false } } } @@ -36871,6 +37595,22 @@ } }, "definitions": { + "AccessInfo": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "scope-tag": { + "type": "string" + }, + "target-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["target-tag", "scope-tag", "role"] + }, "ChangeSecretBackendArg": { "type": "object", "properties": { @@ -36947,6 +37687,12 @@ "ListSecretResult": { "type": "object", "properties": { + "access": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessInfo" + } + }, "create-time": { "type": "string", "format": "date-time" @@ -37313,6 +38059,22 @@ } }, "definitions": { + "AccessInfo": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "scope-tag": { + "type": "string" + }, + "target-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["target-tag", "scope-tag", "role"] + }, "CreateSecretArg": { "type": "object", "properties": { @@ -37380,6 +38142,9 @@ "DeleteSecretArg": { "type": "object", "properties": { + "label": { + "type": "string" + }, "revisions": { "type": "array", "items": { @@ -37391,7 +38156,7 @@ } }, "additionalProperties": false, - "required": ["uri"] + "required": ["uri", "label"] }, "DeleteSecretArgs": { "type": "object", @@ -37559,6 +38324,12 @@ "ListSecretResult": { "type": "object", "properties": { + "access": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessInfo" + } + }, "create-time": { "type": "string", "format": "date-time" @@ -37638,10 +38409,13 @@ "items": { "type": "string" } + }, + "for-drain": { + "type": "boolean" } }, "additionalProperties": false, - "required": ["backend-ids"] + "required": ["for-drain", "backend-ids"] }, "SecretBackendConfig": { "type": "object", @@ -41812,6 +42586,30 @@ "Schema": { "type": "object", "properties": { + "CloudSpec": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/Entities" + }, + "Result": { + "$ref": "#/definitions/CloudSpecResults" + } + }, + "description": "CloudSpec returns the model's cloud spec." + }, + "GetCloudSpec": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/ModelTag" + }, + "Result": { + "$ref": "#/definitions/CloudSpecResult" + } + }, + "description": "GetCloudSpec constructs the CloudSpec for a validated and authorized model." + }, "ModelConfig": { "type": "object", "properties": { @@ -41819,7 +42617,7 @@ "$ref": "#/definitions/ModelConfigResult" } }, - "description": "ModelConfig returns the model's configuration." + "description": "ModelConfig returns the current model's configuration." }, "ModelInfo": { "type": "object", @@ -41850,6 +42648,36 @@ }, "description": "SetStatus sets the status of each given entity." }, + "WatchCloudSpecsChanges": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/Entities" + }, + "Result": { + "$ref": "#/definitions/NotifyWatchResults" + } + }, + "description": "WatchCloudSpecsChanges returns a watcher for cloud spec changes." + }, + "WatchForModelConfigChanges": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/NotifyWatchResult" + } + }, + "description": "WatchForModelConfigChanges returns a NotifyWatcher that observes\nchanges to the model configuration.\nNote that although the NotifyWatchResult contains an Error field,\nit's not used because we are only returning a single watcher,\nso we use the regular error return." + }, + "WatchModel": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/NotifyWatchResults" + } + }, + "description": "WatchModel creates a watcher for the current model." + }, "WatchModelResources": { "type": "object", "properties": { @@ -41861,6 +42689,117 @@ } }, "definitions": { + "CloudCredential": { + "type": "object", + "properties": { + "attrs": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "auth-type": { + "type": "string" + }, + "redacted": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": ["auth-type"] + }, + "CloudSpec": { + "type": "object", + "properties": { + "cacertificates": { + "type": "array", + "items": { + "type": "string" + } + }, + "credential": { + "$ref": "#/definitions/CloudCredential" + }, + "endpoint": { + "type": "string" + }, + "identity-endpoint": { + "type": "string" + }, + "is-controller-cloud": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "region": { + "type": "string" + }, + "skip-tls-verify": { + "type": "boolean" + }, + "storage-endpoint": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["type", "name"] + }, + "CloudSpecResult": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + }, + "result": { + "$ref": "#/definitions/CloudSpec" + } + }, + "additionalProperties": false + }, + "CloudSpecResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/CloudSpecResult" + } + } + }, + "additionalProperties": false + }, + "Entities": { + "type": "object", + "properties": { + "entities": { + "type": "array", + "items": { + "$ref": "#/definitions/Entity" + } + } + }, + "additionalProperties": false, + "required": ["entities"] + }, + "Entity": { + "type": "object", + "properties": { + "tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["tag"] + }, "EntityStatusArgs": { "type": "object", "properties": { @@ -41946,6 +42885,10 @@ "additionalProperties": false, "required": ["config"] }, + "ModelTag": { + "type": "object", + "additionalProperties": false + }, "NotifyWatchResult": { "type": "object", "properties": { @@ -42207,7 +43150,7 @@ { "Name": "Uniter", "Description": "UniterAPI implements the latest version (v18) of the Uniter API.", - "Version": 18, + "Version": 19, "AvailableTo": [ "controller-machine-agent", "machine-agent", @@ -42735,15 +43678,6 @@ }, "description": "ModelConfig returns the current model's configuration." }, - "ModelUUID": { - "type": "object", - "properties": { - "Result": { - "$ref": "#/definitions/StringResult" - } - }, - "description": "ModelUUID returns the model UUID that this unit resides in.\nIt is implemented here directly as a result of removing it from\nembedded APIAddresser *without* bumping the facade version.\nIt should be blanked when this facade version is next incremented." - }, "NetworkInfo": { "type": "object", "properties": { @@ -42756,18 +43690,6 @@ }, "description": "NetworkInfo returns network interfaces/addresses for specified bindings." }, - "OpenedApplicationPortRangesByEndpoint": { - "type": "object", - "properties": { - "Params": { - "$ref": "#/definitions/Entity" - }, - "Result": { - "$ref": "#/definitions/ApplicationOpenedPortsResults" - } - }, - "description": "OpenedApplicationPortRangesByEndpoint returns the port ranges opened by each application." - }, "OpenedMachinePortRangesByEndpoint": { "type": "object", "properties": { @@ -43466,6 +44388,22 @@ "additionalProperties": false, "required": ["servers"] }, + "AccessInfo": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "scope-tag": { + "type": "string" + }, + "target-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["target-tag", "scope-tag", "role"] + }, "Action": { "type": "object", "properties": { @@ -43649,51 +44587,6 @@ "additionalProperties": false, "required": ["value", "type", "scope"] }, - "ApplicationOpenedPorts": { - "type": "object", - "properties": { - "endpoint": { - "type": "string" - }, - "port-ranges": { - "type": "array", - "items": { - "$ref": "#/definitions/PortRange" - } - } - }, - "additionalProperties": false, - "required": ["endpoint", "port-ranges"] - }, - "ApplicationOpenedPortsResult": { - "type": "object", - "properties": { - "application-port-ranges": { - "type": "array", - "items": { - "$ref": "#/definitions/ApplicationOpenedPorts" - } - }, - "error": { - "$ref": "#/definitions/Error" - } - }, - "additionalProperties": false, - "required": ["application-port-ranges"] - }, - "ApplicationOpenedPortsResults": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/ApplicationOpenedPortsResult" - } - } - }, - "additionalProperties": false, - "required": ["results"] - }, "ApplicationStatusResult": { "type": "object", "properties": { @@ -43939,6 +44832,12 @@ "$ref": "#/definitions/GrantRevokeSecretArg" } }, + "secret-track-latest": { + "type": "array", + "items": { + "type": "string" + } + }, "secret-updates": { "type": "array", "items": { @@ -44073,6 +44972,9 @@ "DeleteSecretArg": { "type": "object", "properties": { + "label": { + "type": "string" + }, "revisions": { "type": "array", "items": { @@ -44084,7 +44986,7 @@ } }, "additionalProperties": false, - "required": ["uri"] + "required": ["uri", "label"] }, "DeleteSecretArgs": { "type": "object", @@ -44581,6 +45483,12 @@ "ListSecretResult": { "type": "object", "properties": { + "access": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessInfo" + } + }, "create-time": { "type": "string", "format": "date-time" @@ -45316,10 +46224,13 @@ "items": { "type": "string" } + }, + "for-drain": { + "type": "boolean" } }, "additionalProperties": false, - "required": ["backend-ids"] + "required": ["for-drain", "backend-ids"] }, "SecretBackendConfig": { "type": "object", @@ -47606,6 +48517,634 @@ } } }, + { + "Name": "UserSecretsDrain", + "Description": "SecretsDrainAPI is the implementation for the SecretsDrain facade.", + "Version": 1, + "AvailableTo": ["controller-machine-agent"], + "Schema": { + "type": "object", + "properties": { + "ChangeSecretBackend": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/ChangeSecretBackendArgs" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "ChangeSecretBackend updates the backend for the specified secret after migration done." + }, + "GetSecretBackendConfigs": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/SecretBackendArgs" + }, + "Result": { + "$ref": "#/definitions/SecretBackendConfigResults" + } + }, + "description": "GetSecretBackendConfigs gets the config needed to create a client to secret backends for the drain worker." + }, + "GetSecretContentInfo": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/GetSecretContentArgs" + }, + "Result": { + "$ref": "#/definitions/SecretContentResults" + } + }, + "description": "GetSecretContentInfo returns the secret values for the specified secrets." + }, + "GetSecretRevisionContentInfo": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/SecretRevisionArg" + }, + "Result": { + "$ref": "#/definitions/SecretContentResults" + } + }, + "description": "GetSecretRevisionContentInfo returns the secret values for the specified secret revisions." + }, + "GetSecretsToDrain": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/ListSecretResults" + } + }, + "description": "GetSecretsToDrain returns metadata for the secrets that need to be drained." + }, + "WatchSecretBackendChanged": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/NotifyWatchResult" + } + }, + "description": "WatchSecretBackendChanged sets up a watcher to notify of changes to the secret backend." + } + }, + "definitions": { + "AccessInfo": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "scope-tag": { + "type": "string" + }, + "target-tag": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["target-tag", "scope-tag", "role"] + }, + "ChangeSecretBackendArg": { + "type": "object", + "properties": { + "content": { + "$ref": "#/definitions/SecretContentParams" + }, + "revision": { + "type": "integer" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri", "revision"] + }, + "ChangeSecretBackendArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/ChangeSecretBackendArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, + "Error": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "info": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "message": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["message", "code"] + }, + "ErrorResult": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false + }, + "ErrorResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ErrorResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "GetSecretContentArg": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "peek": { + "type": "boolean" + }, + "refresh": { + "type": "boolean" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri"] + }, + "GetSecretContentArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/GetSecretContentArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, + "ListSecretResult": { + "type": "object", + "properties": { + "access": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessInfo" + } + }, + "create-time": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "label": { + "type": "string" + }, + "latest-expire-time": { + "type": "string", + "format": "date-time" + }, + "latest-revision": { + "type": "integer" + }, + "next-rotate-time": { + "type": "string", + "format": "date-time" + }, + "owner-tag": { + "type": "string" + }, + "revisions": { + "type": "array", + "items": { + "$ref": "#/definitions/SecretRevision" + } + }, + "rotate-policy": { + "type": "string" + }, + "update-time": { + "type": "string", + "format": "date-time" + }, + "uri": { + "type": "string" + }, + "value": { + "$ref": "#/definitions/SecretValueResult" + }, + "version": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "uri", + "version", + "owner-tag", + "latest-revision", + "create-time", + "update-time", + "revisions" + ] + }, + "ListSecretResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ListSecretResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "NotifyWatchResult": { + "type": "object", + "properties": { + "NotifyWatcherId": { + "type": "string" + }, + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false, + "required": ["NotifyWatcherId"] + }, + "SecretBackendArgs": { + "type": "object", + "properties": { + "backend-ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "for-drain": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": ["for-drain", "backend-ids"] + }, + "SecretBackendConfig": { + "type": "object", + "properties": { + "params": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["type"] + }, + "SecretBackendConfigResult": { + "type": "object", + "properties": { + "config": { + "$ref": "#/definitions/SecretBackendConfig" + }, + "draining": { + "type": "boolean" + }, + "model-controller": { + "type": "string" + }, + "model-name": { + "type": "string" + }, + "model-uuid": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "model-controller", + "model-uuid", + "model-name", + "draining" + ] + }, + "SecretBackendConfigResults": { + "type": "object", + "properties": { + "active-id": { + "type": "string" + }, + "results": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/definitions/SecretBackendConfigResult" + } + } + } + }, + "additionalProperties": false, + "required": ["active-id"] + }, + "SecretContentParams": { + "type": "object", + "properties": { + "data": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "value-ref": { + "$ref": "#/definitions/SecretValueRef" + } + }, + "additionalProperties": false + }, + "SecretContentResult": { + "type": "object", + "properties": { + "backend-config": { + "$ref": "#/definitions/SecretBackendConfigResult" + }, + "content": { + "$ref": "#/definitions/SecretContentParams" + }, + "error": { + "$ref": "#/definitions/Error" + }, + "latest-revision": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": ["content"] + }, + "SecretContentResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/SecretContentResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "SecretRevision": { + "type": "object", + "properties": { + "backend-name": { + "type": "string" + }, + "create-time": { + "type": "string", + "format": "date-time" + }, + "expire-time": { + "type": "string", + "format": "date-time" + }, + "revision": { + "type": "integer" + }, + "update-time": { + "type": "string", + "format": "date-time" + }, + "value-ref": { + "$ref": "#/definitions/SecretValueRef" + } + }, + "additionalProperties": false, + "required": ["revision"] + }, + "SecretRevisionArg": { + "type": "object", + "properties": { + "pending-delete": { + "type": "boolean" + }, + "revisions": { + "type": "array", + "items": { + "type": "integer" + } + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri", "revisions", "pending-delete"] + }, + "SecretValueRef": { + "type": "object", + "properties": { + "backend-id": { + "type": "string" + }, + "revision-id": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["backend-id", "revision-id"] + }, + "SecretValueResult": { + "type": "object", + "properties": { + "data": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false + } + } + } + }, + { + "Name": "UserSecretsManager", + "Description": "UserSecretsManager is the implementation for the usersecrets facade.", + "Version": 1, + "AvailableTo": ["controller-machine-agent"], + "Schema": { + "type": "object", + "properties": { + "DeleteRevisions": { + "type": "object", + "properties": { + "Params": { + "$ref": "#/definitions/DeleteSecretArgs" + }, + "Result": { + "$ref": "#/definitions/ErrorResults" + } + }, + "description": "DeleteRevisions deletes the specified revisions of the specified secret." + }, + "WatchRevisionsToPrune": { + "type": "object", + "properties": { + "Result": { + "$ref": "#/definitions/StringsWatchResult" + } + }, + "description": "WatchRevisionsToPrune returns a watcher for notifying when:\n - a secret revision owned by the model no longer\n has any consumers and should be pruned." + } + }, + "definitions": { + "DeleteSecretArg": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "revisions": { + "type": "array", + "items": { + "type": "integer" + } + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["uri", "label"] + }, + "DeleteSecretArgs": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/DeleteSecretArg" + } + } + }, + "additionalProperties": false, + "required": ["args"] + }, + "Error": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "info": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "additionalProperties": true + } + } + }, + "message": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["message", "code"] + }, + "ErrorResult": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + } + }, + "additionalProperties": false + }, + "ErrorResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ErrorResult" + } + } + }, + "additionalProperties": false, + "required": ["results"] + }, + "StringsWatchResult": { + "type": "object", + "properties": { + "changes": { + "type": "array", + "items": { + "type": "string" + } + }, + "error": { + "$ref": "#/definitions/Error" + }, + "watcher-id": { + "type": "string" + } + }, + "additionalProperties": false, + "required": ["watcher-id"] + } + } + } + }, { "Name": "VolumeAttachmentPlansWatcher", "Description": "srvMachineStorageIdsWatcher defines the API wrapping a state.StringsWatcher\nwatching machine/storage attachments. This watcher notifies about storage\nentities (volumes/filesystems) being attached to and detached from machines.\n\nTODO(axw) state needs a new watcher, this is a bt of a hack. State watchers\ncould do with some deduplication of logic, and I don't want to add to that\nspaghetti right now.", diff --git a/package.json b/package.json index 13cc62d21..e87e429c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@canonical/jujulib", - "version": "4.0.0", + "version": "4.1.0", "description": "Juju API client", "main": "dist/api/client.js", "types": "dist/api/client.d.ts", @@ -8,7 +8,7 @@ "scripts": { "build": "tsc", "clean": "rm -rf node_modules dist", - "generate-facades": "SCHEMA=generator/schema/schema.json JUJU_VERSION=$(cat generator/schema/juju-version.txt) JUJU_GIT_SHA=$(cat generator/schema/juju-git-sha.txt) ts-node generator/index.ts", + "generate-facades": "SCHEMA=generator/schema/schema.json JUJU_VERSION=$(cat generator/schema/juju-version.txt) JUJU_GIT_SHA=$(cat generator/schema/juju-git-sha.txt) node --no-warnings=ExperimentalWarning --loader ts-node/esm generator/index.ts", "regenerate-all-facades": "node generator/schema/regenerate-all.js", "store-schema": "./generator/scripts/store-schema.sh", "generate-docs": "README_FOR_DOCS=true yarn generate-facades && typedoc api/* --out docs --entryPointStrategy expand --includeVersion --gitRemote upstream", From 4ced017a8bf1c15f8e3acf03c08824471fcfae68 Mon Sep 17 00:00:00 2001 From: Huw Wilkins Date: Fri, 5 Jan 2024 15:11:54 +1100 Subject: [PATCH 2/2] Add trailing line. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f926361f4..d07f1d9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ api/!(test)**/*.js dist/ .nyc_output/ docs -.nfs.* \ No newline at end of file +.nfs.*