@zowe/core-for-zowe-sdk
Version:
Core libraries shared by Zowe SDK packages
333 lines • 14.5 kB
JavaScript
"use strict";
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfileConstants = void 0;
const imperative_1 = require("@zowe/imperative");
/**
* Class containing the various profile related constants
*/
class ProfileConstants {
}
exports.ProfileConstants = ProfileConstants;
ProfileConstants.BASE_CONNECTION_OPTION_GROUP = "Base Connection Options";
/**
* Option used in profile creation and commands for hostname
*/
ProfileConstants.BASE_OPTION_HOST = {
name: "host",
aliases: ["H"],
description: "Host name of service on the mainframe.",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for port
*/
ProfileConstants.BASE_OPTION_PORT = {
name: "port",
aliases: ["P"],
description: "Port number of service on the mainframe.",
type: "number",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for username / ID
*/
ProfileConstants.BASE_OPTION_USER = {
name: "user",
aliases: ["u"],
description: "User name to authenticate to service on the mainframe.",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for password/passphrase
*/
ProfileConstants.BASE_OPTION_PASSWORD = {
name: "password",
aliases: ["pass", "pw"],
description: "Password to authenticate to service on the mainframe.",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for rejectUnauthorized setting for connecting to z/OSMF
*/
ProfileConstants.BASE_OPTION_REJECT_UNAUTHORIZED = {
name: "reject-unauthorized",
aliases: ["ru"],
description: "Reject self-signed certificates.",
type: "boolean",
defaultValue: true,
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for tokenType
*/
ProfileConstants.BASE_OPTION_TOKEN_TYPE = {
name: "token-type",
aliases: ["tt"],
description: "The type of token to get and use for the API. Omit this option to use the default token type, which is provided by " +
"'zowe auth login'.",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used in profile creation and commands for tokenValue to be used to interact with APIs
*/
ProfileConstants.BASE_OPTION_TOKEN_VALUE = {
name: "token-value",
aliases: ["tv"],
description: "The value of the token to pass to the API.",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used to specify the path to the certificate file for authentication
*/
ProfileConstants.BASE_OPTION_CERT_FILE = {
name: "cert-file",
description: "The file path to a certificate file to use for authentication.\n\nNote: " +
"The CLI does not support certificate files that require a password. " +
"For more information, search Troubleshooting PEM Certificates in Zowe Docs.",
type: "existingLocalFile",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used to specify the path to the certificate file for authentication
*/
ProfileConstants.BASE_OPTION_CERT_KEY_FILE = {
name: "cert-key-file",
description: "The file path to a certificate key file to use for authentication",
type: "existingLocalFile",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used to specify the account name for PKCS 12 certificate stored in credential manager
*/
ProfileConstants.BASE_OPTION_CERT_ACCOUNT = {
name: "cert-account",
description: "The account name for PKCS 12 certificate stored in credential manager",
type: "string",
group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
};
/**
* Option used to specify the path to the certificate file for authentication
*/
// public static readonly BASE_OPTION_CERT_FILE_PASSPHRASE: ICommandOptionDefinition = {
// name: "cert-file-passphrase",
// description: "The passphrase to decrypt a certificate file to use for authentication",
// type: "string",
// group: ProfileConstants.BASE_CONNECTION_OPTION_GROUP
// };
ProfileConstants.AUTO_INIT_OPTION_GROUP = "APIML Connection Options";
/**
* Option used in profile creation and commands for hostname
*/
ProfileConstants.AUTO_INIT_OPTION_HOST = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_HOST), { description: "Host name of the mainframe running the API Mediation Layer.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for port
*/
ProfileConstants.AUTO_INIT_OPTION_PORT = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_PORT), { description: "Port number of API Mediation Layer on the mainframe.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for username / ID
*/
ProfileConstants.AUTO_INIT_OPTION_USER = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_USER), { description: "User name to authenticate to the API Mediation Layer on the mainframe.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for password/passphrase
*/
ProfileConstants.AUTO_INIT_OPTION_PASSWORD = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_PASSWORD), { description: "Password to authenticate to the API Mediation Layer on the mainframe.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for rejectUnauthorized setting for connecting to z/OSMF
*/
ProfileConstants.AUTO_INIT_OPTION_REJECT_UNAUTHORIZED = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_REJECT_UNAUTHORIZED), { group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for tokenType
*/
ProfileConstants.AUTO_INIT_OPTION_TOKEN_TYPE = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_TOKEN_TYPE), { description: "The type of token to get and use for the API Mediation Layer. " +
"Omit this option to use the default token type, which is provided by 'zowe auth login'.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for tokenValue to be used to interact with APIs
*/
ProfileConstants.AUTO_INIT_OPTION_TOKEN_VALUE = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_TOKEN_VALUE), { description: "The value of the token to pass to the API Mediation Layer.", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for certificate file to be used to interact with login APIs
*/
ProfileConstants.AUTO_INIT_OPTION_CERT_FILE = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_CERT_FILE), { description: "The file path to a certificate file to use to authenticate to the API Mediation Layer", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for certificate key file to be used to interact with login APIs
*/
ProfileConstants.AUTO_INIT_OPTION_CERT_KEY_FILE = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_CERT_KEY_FILE), { description: "The file path to a certificate key file to use to authenticate to the API Mediation Layer", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Option used in profile creation and commands for cert account
*/
ProfileConstants.AUTO_INIT_OPTION_CERT_ACCOUNT = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_CERT_ACCOUNT), { description: "The account name for PKCS 12 certificate stored in credential manager for the API Mediation Layer", group: ProfileConstants.AUTO_INIT_OPTION_GROUP });
/**
* Summary of auth command group
* @static
* @memberof AuthConstants
*/
ProfileConstants.AUTH_GROUP_SUMMARY = "Connect to Zowe API ML authentication service";
/**
* Description of auth command group
* @static
* @memberof AuthConstants
*/
ProfileConstants.AUTH_GROUP_DESCRIPTION = "Connect to Zowe API Mediation Layer authentication service and obtain a token, or disconnect " +
"from the authentication service and revoke the token.\n" +
"\n" +
"The token provides authentication to services that support the API ML SSO (Single Sign-On) capability. When you log in, the token is " +
"stored in your default base profile until it expires. Base profiles store connection information shared by multiple services (e.g., " +
"z/OSMF), and are used if you do not supply connection information in a service profile. To take advantage of the API ML SSO capability, " +
"you should omit username and password in service profiles so that the token in the base profile is used.";
/**
* Summary of APIML login command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGIN_SUMMARY = "Log in to API ML authentication service";
/**
* Description of APIML login command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGIN_DESCRIPTION = "Log in to Zowe API Mediation Layer authentication service and obtain or update a token.\n" +
"\n" +
"The token provides authentication to services that support the API ML SSO (Single Sign-On) capability. When you log in, the token is " +
"stored in your default base profile until it expires. Base profiles store connection information shared by multiple services (e.g., " +
"z/OSMF), and are used if you do not supply connection information in a service profile. To take advantage of the API ML SSO capability, " +
"you should omit username and password in service profiles so that the token in the base profile is used.";
/**
* Example definition for APIML login command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGIN_EXAMPLE1 = {
description: "Log in to an API ML instance to obtain or update the token stored in your base profile",
options: ""
};
/**
* Example definition for APIML login command with show-token
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGIN_EXAMPLE2 = {
description: "Log in to an API ML instance to obtain a token without storing it in a profile",
options: "--show-token"
};
/**
* Summary of APIML logout command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGOUT_SUMMARY = "Log out of API ML authentication service";
/**
* Description of APIML logout command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGOUT_DESCRIPTION = "Log out of the Zowe API Mediation Layer authentication service and revoke the token so it " +
"can no longer authenticate. Also remove the token from the default base profile, if it is stored on disk.";
/**
* Example definition for APIML logout command
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGOUT_EXAMPLE1 = {
description: "Log out of an API ML instance to revoke the token that was in use and remove it from your base profile",
options: ""
};
/**
* Example definition for APIML logout command with token-value
* @static
* @memberof AuthConstants
*/
ProfileConstants.APIML_LOGOUT_EXAMPLE2 = {
description: "Log out of an API ML instance to revoke a token that was not stored in a profile",
options: "--token-value <token>"
};
/**
* Option used in APIML logout command for token-type
*/
ProfileConstants.APIML_LOGOUT_OPTION_TOKEN_TYPE = Object.assign(Object.assign({}, ProfileConstants.BASE_OPTION_TOKEN_TYPE), { allowableValues: {
values: imperative_1.SessConstants.ALL_TOKEN_TYPES
.map(tk => tk.indexOf(imperative_1.SessConstants.TOKEN_TYPE_APIML) >= 0 ? `${imperative_1.SessConstants.TOKEN_TYPE_APIML}.*` : tk)
} });
/**
* Profile configuration for SSH profiles
* @type {ICommandProfileTypeConfiguration}
* @memberof BaseProfile
*/
ProfileConstants.BaseProfile = {
type: "base",
schema: {
type: "object",
title: "Base Profile",
description: "Base profile that stores values shared by multiple service profiles",
properties: {
host: {
type: "string",
optionDefinition: ProfileConstants.BASE_OPTION_HOST,
includeInTemplate: true
},
port: {
type: "number",
optionDefinition: ProfileConstants.BASE_OPTION_PORT
},
user: {
type: "string",
secure: true,
optionDefinition: ProfileConstants.BASE_OPTION_USER,
includeInTemplate: true
},
password: {
type: "string",
secure: true,
optionDefinition: ProfileConstants.BASE_OPTION_PASSWORD,
includeInTemplate: true
},
rejectUnauthorized: {
type: "boolean",
optionDefinition: ProfileConstants.BASE_OPTION_REJECT_UNAUTHORIZED,
includeInTemplate: true
},
tokenType: {
type: "string",
optionDefinition: ProfileConstants.BASE_OPTION_TOKEN_TYPE
},
tokenValue: {
type: "string",
secure: true,
optionDefinition: ProfileConstants.BASE_OPTION_TOKEN_VALUE
},
certFile: {
type: "string",
optionDefinition: ProfileConstants.BASE_OPTION_CERT_FILE
},
certKeyFile: {
type: "string",
optionDefinition: ProfileConstants.BASE_OPTION_CERT_KEY_FILE
},
certAccount: {
type: "string",
optionDefinition: ProfileConstants.BASE_OPTION_CERT_ACCOUNT
// },
// certFilePassphrase: {
// type: "string",
// secure: true,
// optionDefinition: BASE_OPTION_CERT_FILE_PASSPHRASE
}
},
required: []
}
};
//# sourceMappingURL=Core.constants.js.map