UNPKG

@canonical/jujulib

Version:

Juju API client

2,164 lines (1,852 loc) 64.6 kB
/** 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 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<string, StatusResult>; } 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<string, string>; "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<string, string>; } 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<string, Record<string, GoalStateStatus>>; units: Record<string, GoalStateStatus>; } 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<string, string>; "unit-tag"?: string; } export interface MeterStatusResult { code: string; error?: Error; info: string; } export interface MeterStatusResults { results: MeterStatusResult[]; } export interface Metric { key: string; labels?: Record<string, string>; 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<string, NetworkInfoResult>; } export interface NotifyWatchResult { NotifyWatcherId: string; error?: Error; } export interface NotifyWatchResults { results: NotifyWatchResult[]; } export interface OpenPortRangesByEndpointResult { error?: Error; "unit-port-ranges": Record<string, OpenUnitPortRangesByEndpoint[]>; } 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<string, string>; relation: string; settings: Record<string, string>; 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<string, number>; changed: Record<string, UnitSettings>; 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<string, SecretBackendConfigResult>; } export interface SecretConsumerInfoResult { error?: Error; label: string; revision: number; } export interface SecretConsumerInfoResults { results: SecretConsumerInfoResult[]; } export interface SecretContentParams { data?: Record<string, string>; "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<string, string>; error?: Error; } export interface SetStatus { entities: EntityStatusArgs[]; } export interface SetUnitStateArg { "charm-state"?: Record<string, string>; "meter-status-state"?: string; "relation-state"?: Record<string, string>; "secret-state"?: string; "storage-state"?: string; tag: string; "uniter-state"?: string; } export interface SetUnitStateArgs { args: SetUnitStateArg[]; } export interface SettingsResult { error?: Error; settings: Record<string, string>; } 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<string, string>; error?: Error; "meter-status-state"?: string; "relation-state"?: Record<string, string>; "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<StringsResult> { 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<APIHostPortsResult> { 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<StringResults> { 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<ActionResults> { 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<ErrorResults> { 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<ApplicationStatusResults> { 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<StringResults> { 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<StringResults> { 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<ErrorResults> { 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<BoolResults> { 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<StringResults> { 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<IntResults> { 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<StringBoolResults> { 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<ErrorResults> { 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<StringResult> { 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<CloudSpecResult> { 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<ErrorResults> { 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<ConfigSettingsResults> { 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<StringResults> { 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<StringResults> { 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<ModelResult> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<SecretConsumerInfoResults> { 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<MeterStatusResults> { 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<StringResults> { 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<StringBoolResults> { 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<StringResults> { 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<SecretBackendConfigResults> { 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<SecretContentResults> { 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<ListSecretResults> { 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<SecretContentResults> { 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<GoalStateResults> { 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<BoolResults> { 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<StringResults> { 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<BoolResults> { 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<ErrorResults> { 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<LifeResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ModelConfigResult> { 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<NetworkInfoResults> { 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<OpenPortRangesByEndpointResults> { 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<OpenPortRangesByEndpointResults> { 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<StringResults> { 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<StringResult> { 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<StringResults> { 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<GetLeadershipSettingsBulkResults> { 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<SettingsResult> { 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<SettingsResults> { 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<SettingsResults> { 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<UnitRefreshResults> { 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<RelationResults> { 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<RelationResults> { 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<RelationUnitStatusResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ResolvedModeResults> { 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<StringResult> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { 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<ErrorResults> { return new Promise((resolve, reject) => { const req: JujuRequest = { type: "Uniter", request: "SetUpgradeSeriesUnitStatus",