-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
313 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ export default abstract class AbstractOperation { | |
} | ||
} | ||
} | ||
|
||
query = JSON.stringify(query); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CreateOptions, CreateArgs } from '../../operations/create'; | ||
import AbstractCreate from '../abstract.create'; | ||
|
||
/** | ||
* Create resources | ||
*/ | ||
export default class Create extends AbstractCreate { | ||
/** | ||
* Apply cli options | ||
*/ | ||
public applyOptions() { | ||
return this.optparse | ||
.subCommand<CreateOptions, CreateArgs>('secrets [name]') | ||
.alias('ar') | ||
.description('Create new secrets') | ||
.action(this.execute.bind(this)); | ||
} | ||
|
||
/** | ||
* Execute | ||
*/ | ||
public async execute(opts, args, rest) { | ||
var api = await this.client.factory('Secrets', this.optparse.parent.parsedOpts); | ||
|
||
this.createObjects('access-role', args, opts, async resource => { | ||
return await api.addSecret(resource); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { DeleteOptions, DeleteArgs } from '../../operations/delete'; | ||
import AbstractDelete from '../abstract.delete'; | ||
|
||
/** | ||
* Delete resources | ||
*/ | ||
export default class Delete extends AbstractDelete { | ||
/** | ||
* Apply cli options | ||
*/ | ||
public applyOptions() { | ||
return this.optparse | ||
.subCommand<DeleteOptions, DeleteArgs>('secrets <mandator> <name>') | ||
.alias('ar') | ||
.description('Delete secret') | ||
.action(this.execute.bind(this)); | ||
} | ||
|
||
/** | ||
* Execute | ||
*/ | ||
public async execute(opts, args, rest) { | ||
var api = await this.client.factory('Secrets', this.optparse.parent.parsedOpts); | ||
await api.deleteSecret(args.name); | ||
console.log('resource %s has been deleted', args.name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { EditOptions, EditArgs } from '../../operations/edit'; | ||
import AbstractEdit from '../abstract.edit'; | ||
|
||
/** | ||
* Edit resources | ||
*/ | ||
export default class Edit extends AbstractEdit { | ||
/** | ||
* Apply cli options | ||
*/ | ||
public applyOptions() { | ||
return this.optparse | ||
.subCommand<EditOptions, EditArgs>('secrets [name]') | ||
.alias('ar') | ||
.description('Edit secrets') | ||
.action(this.execute.bind(this)); | ||
} | ||
|
||
/** | ||
* Execute | ||
*/ | ||
public async execute(opts, args, rest) { | ||
var api = await this.client.factory('Secrets', this.optparse.parent.parsedOpts); | ||
|
||
if (args.name) { | ||
var response = await api.getSecret(args.name, this.getFields(opts)); | ||
} else { | ||
var response = await api.getSecrets(...this.getQueryOptions(opts, args)); | ||
} | ||
|
||
this.editObjects(response, opts, async (name, patch) => { | ||
return await api.updateSecret(name, patch); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { GetOptions, GetArgs } from '../../operations/get'; | ||
import AbstractGet from '../abstract.get'; | ||
|
||
/** | ||
* * Edit resources | ||
* */ | ||
export default class Get extends AbstractGet { | ||
/** | ||
* Apply cli options | ||
*/ | ||
public applyOptions() { | ||
return this.optparse | ||
.subCommand<GetOptions, GetArgs>('secrets [name]') | ||
.alias('ar') | ||
.description('Get secrets') | ||
.action(this.execute.bind(this)); | ||
} | ||
|
||
/** | ||
* Execute | ||
*/ | ||
public async execute(opts, args, rest) { | ||
var category = await this.client.factory('Secrets', this.optparse.parent.parsedOpts); | ||
|
||
if (opts.watch) { | ||
if (args.name) { | ||
var request = category.watchSecrets(...this.getQueryOptions(opts, args)); | ||
this.watchObjects(request, opts); | ||
} else { | ||
var request = category.watchSecrets(...this.getQueryOptions(opts, args)); | ||
this.watchObjects(request, opts); | ||
} | ||
} else { | ||
if (args.name) { | ||
var response = await category.getSecret(args.name, ...this.getFields(opts)); | ||
this.getObjects(response, opts); | ||
} else { | ||
var response = await category.getSecrets(...this.getQueryOptions(opts, args)); | ||
this.getObjects(response, opts); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CreateOptions, CreateArgs } from '../../operations/create'; | ||
import AbstractCreate from '../abstract.create'; | ||
|
||
/** | ||
* Create resources | ||
*/ | ||
export default class Create extends AbstractCreate { | ||
/** | ||
* Apply cli options | ||
*/ | ||
public applyOptions() { | ||
return this.optparse | ||
.subCommand<CreateOptions, CreateArgs>('users [name]') | ||
.alias('ar') | ||
.description('Create new users') | ||
.action(this.execute.bind(this)); | ||
} | ||
|
||
/** | ||
* Execute | ||
*/ | ||
public async execute(opts, args, rest) { | ||
var api = await this.client.factory('Users', this.optparse.parent.parsedOpts); | ||
|
||
this.createObjects('user', args, opts, async resource => { | ||
return await api.addUser(resource); | ||
}); | ||
} | ||
} |
Oops, something went wrong.