Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add list and get methods for keystores in Apigee #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ You must have an account on Apigee Edge to perform any `apigeetool` functions. T
* create or delete a Cache resource in Edge
* create, retrieve or delete a KVM Map in Edge
* create, retrieve or delete a KVM Entry in Edge
* create, retrieve or delete a Keystore in Edge
* retrieve a Keystore Reference in Edge
* retrieve a Keystore Alias in Edge
* retrieve a Certificate from a Keystore in Edge
* attach, detach, or get a FlowHook
* create, get, delete, list Target Servers
* create, get, delete, List Roles
Expand Down Expand Up @@ -119,6 +123,7 @@ Currently this only affects file uploads in the `deploynodeapp` command. Default
* [deleteapp](#deleteapp)
* [deletecache](#deletecache)
* [deletedeveloper](#deletedeveloper)
* [deleteKeystore](#deleteKeystore)
* [deleteKVMentry](#deleteKVMentry)
* [deleteKVMmap](#deleteKVMmap)
* [deleteproduct](#deleteproduct)
Expand All @@ -133,14 +138,19 @@ Currently this only affects file uploads in the `deploynodeapp` command. Default
* [detachFlowHook](#detachFlowHook)
* [fetchproxy](#fetchproxy)
* [fetchSharedflow](#fetchSharedflow)
* [getAlias](#getAlias)
* [getCertificate](#getCertificate)
* [getFlowHook](#getFlowHook)
* [getKVMentry](#getKVMentry)
* [getKVMmap](#getKVMmap)
* [getlogs](#getlogs)
* [getReference](#getReference)
* [getRole](#getRole)
* [getRolePermissions](#getRolePermissions)
* [getTargetServer](#getTargetServer)
* [listdeployments](#listdeployments)
* [listKeystores](#listKeystores)
* [listReferences](#listReferences)
* [listRoles](#listRoles)
* [listRoleUsers](#listRoleUsers)
* [listSharedflowDeployments](#listSharedflowDeployments)
Expand Down Expand Up @@ -1419,6 +1429,141 @@ the "-u" and "-p" parameters for username and password or preferably -N for .net
`--email` (required) Email for an existing User in Edge.
`--roleName` (required) The name for the role.

## <a name="Keystore Operations"></a>Keystore Operations

### <a name="getAlias"></a>getAlias

Get details about certificate alias.

#### Example
Get details about a certificate from the specific keystore "MyKeyStore-20210101" , using the cert alias "my-cert-alias".

apigeetool getAlias --keystoreName MyKeyStore-20210101 --aliasName my-cert-alias

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.··
`--environment -e` (required) The environment to target.··
`--keystoreName` (required) The keystore to query.
`--aliasName` (required) The alias to query

### <a name="getCertificate"></a>getCertificate

Get details about a certificate in a keystore.

#### Example
Get details about the certificate "my-cert" in the keystore "MyKeyStore-20210101"

apigeetool getCertificate --keystoreName MyKeyStore-20210101 --certificateName my-cert

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.··
`--environment -e` (required) The environment to target.··
`--keystoreName` (required) The keystore to query.
`--certificateName` (required) The certificate to query

### <a name="getKeystore"></a>getKeystore

Get details about a keystore

#### Example
Get details about the keystore "MyKeyStore-20210101"

apigeetool getKeystore --keystoreName MyKeyStore-20210101

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.··
`--environment -e` (required) The environment to target.··
`--keystoreName` (required) The keystore to query.

### <a name="getReference"></a>getReference

Get details about a reference

#### Example
Get details about the reference "TLSReference" about which real keystore it is pointing at.

apigeetool getreference --referenceName "TLSReference"

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.··
`--environment -e` (required) The environment to target.··
`--referenceName` (required) The reference to query.

### <a name="listKeystores"></a>listKeystores

List all the keystore in an Apigee Environment

#### Example
List Keystores in the Dev Environment

apigeetool listKeystores -e "Dev"

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.··
`--environment -e` (required) The environment to target.··

### <a name="deleteKeystores"></a>deleteKeystore

Delete a keystore.

#### Example
Delete a keystore "MyKeyStore-20210101"

apigeetool deleteKeystore --keystoreName MyKeyStore-20210101

#### Required parameters

The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.

See [Common Parameters](#commonargs) for a list of additional parameters, including
the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

`--organization -o` (required) The organization to target.
`--environment -e` (required) The environment to target.
`--keystoreName` (required) The keystore to delete.

# <a name="sdkreference"></a>SDK Reference

You could use apigeetool as an SDK to orchestrate tasks that you want to perform with Edge, for eg, deploying an api proxy or running tests etc.
Expand Down
42 changes: 42 additions & 0 deletions lib/commands/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,48 @@ var Commands = {
load: function () {
return require('./listRoleUsers');
}
},
listKeystores: {
description: "List Keystores",
load: function () {
return require('./listKeystores');
}
},
listReferences: {
description: "List References",
load: function () {
return require('./listReferences');
}
},
getKeystore: {
description: "Get Keystore",
load: function () {
return require('./getKeystore');
}
},
deleteKeystore: {
description: "Delete Keystore",
load: function () {
return require('./deleteKeystore');
}
},
getReference: {
description: "Get References",
load: function () {
return require('./getReference');
}
},
getAlias: {
description: "Get Alias",
load: function () {
return require('./getAlias');
}
},
getCertificate: {
description: "Get Certificate",
load: function () {
return require('./getCertificate');
}
}
};

Expand Down
38 changes: 38 additions & 0 deletions lib/commands/deleteKeystore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* jshint node: true */
'use strict';

var util = require('util');
var _ = require('underscore');

var defaults = require('../defaults');
var options = require('../options');
var command_utils = require('./command-utils')

var descriptor = defaults.defaultDescriptor({
environment: {
name: 'Environment',
shortOption: 'e',
required: true,
prompt: true
},
keystoreName:{
name:'Keystore Name',
required: true,
prompt: true
}
});

module.exports.descriptor = descriptor;

module.exports.run = function(opts, cb) {
if (opts.debug) {
console.log('deleteKeystore: %j', opts);
}
var uri = util.format('%s/v1/o/%s/e/%s/keystores/%s', opts.baseuri, opts.organization, opts.environment, opts.keystoreName);
var requestOptions = {
uri: uri,
method:'DELETE',
json:true
}
command_utils.run('deleteKeystore', opts,requestOptions,cb)
};
43 changes: 43 additions & 0 deletions lib/commands/getAlias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* jshint node: true */
'use strict';

var util = require('util');
var _ = require('underscore');

var defaults = require('../defaults');
var options = require('../options');
var command_utils = require('./command-utils')

var descriptor = defaults.defaultDescriptor({
environment: {
name: 'Environment',
shortOption: 'e',
required: true,
prompt: true
},
keystoreName: {
name:'Keystore Name',
required: true,
prompt: true
},
aliasName: {
name: 'Alias Name',
required: true,
prompt: true
}
});

module.exports.descriptor = descriptor;

module.exports.run = function(opts, cb) {
if (opts.debug) {
console.log('getAlias: %j', opts);
}
var uri = util.format('%s/v1/o/%s/e/%s/keystores/%s/aliases/%s', opts.baseuri, opts.organization, opts.environment, opts.keystoreName, opts.aliasName);
var requestOptions = {
uri: uri,
method:'GET',
json:true
}
command_utils.run('getAlias', opts,requestOptions,cb)
};
43 changes: 43 additions & 0 deletions lib/commands/getCertificate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* jshint node: true */
'use strict';

var util = require('util');
var _ = require('underscore');

var defaults = require('../defaults');
var options = require('../options');
var command_utils = require('./command-utils')

var descriptor = defaults.defaultDescriptor({
environment: {
name: 'Environment',
shortOption: 'e',
required: true,
prompt: true
},
keystoreName: {
name:'Keystore Name',
required: true,
prompt: true
},
certificateName: {
name: 'Certificate Name',
required: true,
prompt: true
}
});

module.exports.descriptor = descriptor;

module.exports.run = function(opts, cb) {
if (opts.debug) {
console.log('getCertificate: %j', opts);
}
var uri = util.format('%s/v1/o/%s/e/%s/keystores/%s/certs/%s', opts.baseuri, opts.organization, opts.environment, opts.keystoreName, opts.certificateName);
var requestOptions = {
uri: uri,
method:'GET',
json:true
}
command_utils.run('getCertificate', opts,requestOptions,cb)
};
38 changes: 38 additions & 0 deletions lib/commands/getKeystore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* jshint node: true */
'use strict';

var util = require('util');
var _ = require('underscore');

var defaults = require('../defaults');
var options = require('../options');
var command_utils = require('./command-utils')

var descriptor = defaults.defaultDescriptor({
environment: {
name: 'Environment',
shortOption: 'e',
required: true,
prompt: true
},
keystoreName:{
name:'Keystore Name',
required: true,
prompt: true
},
});

module.exports.descriptor = descriptor;

module.exports.run = function(opts, cb) {
if (opts.debug) {
console.log('getKeystore: %j', opts);
}
var uri = util.format('%s/v1/o/%s/e/%s/keystores/%s', opts.baseuri, opts.organization, opts.environment, opts.keystoreName);
var requestOptions = {
uri: uri,
method:'GET',
json:true
}
command_utils.run('getKeystore', opts,requestOptions,cb)
};
Loading