@canonical/jujulib
Version:
Juju API client
2,112 lines (1,812 loc) • 54.7 kB
text/typescript
/**
Juju Uniter version 16.
This facade is available on:
Controller-machine-agent
Machine-agent
Unit-agent
Models
NOTE: This file was generated using the Juju schema
from Juju 2.8.2 at the git SHA 516c1904ce.
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 Action {
name: string;
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 {
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;
name: string;
region?: string;
"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[];
"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 Endpoint {
"application-name": string;
relation: CharmRelation;
}
export interface Entities {
entities: Entity[];
}
export interface EntitiesCharmURL {
entities: EntityCharmURL[];
}
export interface EntitiesPortRanges {
entities: EntityPortRange[];
}
export interface Entity {
tag: string;
}
export interface EntityCharmURL {
"charm-url": string;
tag: string;
}
export interface EntityPortRange {
"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 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 HostPort {
Address: Address;
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 MachinePortRange {
"port-range": PortRange;
"relation-tag": string;
"unit-tag": string;
}
export interface MachinePortsResult {
error?: Error;
ports: MachinePortRange[];
}
export interface MachinePortsResults {
results: MachinePortsResult[];
}
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 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 RelationUnitsSettings {
"relation-units": RelationUnitSettings[];
}
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 SetStatus {
entities: EntityStatusArgs[];
}
export interface SetUnitStateArg {
"charm-state"?: Record<string, string>;
"meter-status-state"?: string;
"relation-state"?: Record<string, 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 StoragesAddParams {
storages: StorageAddParams[];
}
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>;
"storage-state"?: string;
"uniter-state"?: string;
}
export interface UnitStateResults {
results: UnitStateResult[];
}
export interface UpgradeSeriesStatusParam {
entity: Entity;
message: string;
status: string;
}
export interface UpgradeSeriesStatusParams {
params: UpgradeSeriesStatusParam[];
}
export interface UpgradeSeriesStatusResult {
error?: Error;
status?: string;
}
export interface UpgradeSeriesStatusResults {
results?: UpgradeSeriesStatusResult[];
}
export interface AdditionalProperties {
[key: string]: any;
}
/**
UniterAPI implements the latest version (v16) of the Uniter API, which adds
LXDProfileAPIv2.
*/
class UniterV16 implements Facade {
static NAME = "Uniter";
static VERSION = 16;
NAME = "Uniter";
VERSION = 16;
_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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
AddUnitStorage validates and creates additional storage instances for units.
Failures on an individual storage instance do not block remaining
instances from being processed.
*/
addUnitStorage(params: StoragesAddParams): Promise<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "AddUnitStorage",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
AllMachinePorts returns all opened port ranges for each given
machine (on all networks).
*/
allMachinePorts(params: Entities): Promise<MachinePortsResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "AllMachinePorts",
version: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ClosePorts sets the policy of the port range with protocol to be
closed, for all given units.
*/
closePorts(params: EntitiesPortRanges): Promise<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "ClosePorts",
version: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
ModelUUID returns the model UUID to connect to the model
that the current connection is for.
*/
modelUUID(params: any): Promise<StringResult> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "ModelUUID",
version: 16,
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: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
OpenPorts sets the policy of the port range with protocol to be
opened, for all given units.
*/
openPorts(params: EntitiesPortRanges): Promise<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "OpenPorts",
version: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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: 16,
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",
version: 16,
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<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "SetWorkloadVersion",
version: 16,
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<UnitStateResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "State",
version: 16,
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<LifeResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "StorageAttachmentLife",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
StorageAttachments returns the storage attachments with the specified tags.
*/
storageAttachments(
params: StorageAttachmentIds
): Promise<StorageAttachmentResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "StorageAttachments",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
UnitStatus returns the workload status information for the unit.
*/
unitStatus(params: Entities): Promise<StatusResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "UnitStatus",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
UnitStorageAttachments returns the IDs of storage attachments for a collection of units.
*/
unitStorageAttachments(
params: Entities
): Promise<StorageAttachmentIdsResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "UnitStorageAttachments",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
UpdateNetworkInfo refreshes the network settings for a unit's bound
endpoints.
*/
updateNetworkInfo(params: Entities): Promise<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "UpdateNetworkInfo",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
UpdateSettings persists all changes made to the local settings of
all given pairs of relation and unit. Keys with empty values are
considered a signal to delete these values.
*/
updateSettings(params: RelationUnitsSettings): Promise<ErrorResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "UpdateSettings",
version: 16,
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<UpgradeSeriesStatusResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "UpgradeSeriesUnitStatus",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
Watch starts an NotifyWatcher for each given entity.
*/
watch(params: Entities): Promise<NotifyWatchResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "Watch",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
WatchAPIHostPorts watches the API server addresses.
*/
watchAPIHostPorts(params: any): Promise<NotifyWatchResult> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchAPIHostPorts",
version: 16,
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<StringsWatchResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchActionNotifications",
version: 16,
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<StringsWatchResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchConfigSettingsHash",
version: 16,
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<NotifyWatchResult> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchForModelConfigChanges",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
WatchInstanceData is a shim to call the LXDProfileAPIv2 version of this method.
*/
watchInstanceData(params: Entities): Promise<NotifyWatchResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchInstanceData",
version: 16,
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<NotifyWatchResults> {
return new Promise((resolve, reject) => {
const req: JujuRequest = {
type: "Uniter",
request: "WatchLeadershipSettings",
version: 16,
params: params,
};
this._transport.write(req, resolve, reject);
});
}
/**
*/
watchMeterStatus(params: Entities): Promise<NotifyWatchResults> {
return new Promise((resolve, reject)