This repository was archived by the owner on Dec 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 13 files changed +114
-16
lines changed Expand file tree Collapse file tree 13 files changed +114
-16
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ export interface ServerlessCommand {
88
88
commands ?: ServerlessCommandMap ;
89
89
}
90
90
91
+ export interface ServerlessHookMap {
92
+ [ eventName : string ] : Promise < any > ;
93
+ }
94
+
91
95
export interface ServerlessCommandMap {
92
96
[ command : string ] : ServerlessCommand ;
93
97
}
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { ApimService } from "../../services/apimService";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureApimFunctionPlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
6
8
7
public constructor ( serverless : Serverless , options : Serverless . Options ) {
9
8
super ( serverless , options ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { ApimService } from "../../services/apimService";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureApimServicePlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
6
8
7
public constructor ( serverless : Serverless , options : Serverless . Options ) {
9
8
super ( serverless , options ) ;
Original file line number Diff line number Diff line change 1
1
import { Guard } from "../shared/guard" ;
2
2
import Serverless from "serverless" ;
3
3
import { Utils } from "../shared/utils" ;
4
+ import { ServerlessCommandMap , ServerlessHookMap } from "../models/serverless" ;
4
5
5
6
export abstract class AzureBasePlugin < TOptions = Serverless . Options > {
7
+
8
+ public hooks : ServerlessHookMap
9
+ protected commands : ServerlessCommandMap ;
10
+
6
11
public constructor (
7
12
protected serverless : Serverless ,
8
13
protected options : TOptions ,
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import { ResourceService } from "../../services/resourceService";
6
6
import { AzureBasePlugin } from "../azureBasePlugin" ;
7
7
8
8
export class AzureDeployPlugin extends AzureBasePlugin < AzureLoginOptions > {
9
- public hooks : { [ eventName : string ] : Promise < any > } ;
10
9
public commands : any ;
11
10
12
11
public constructor ( serverless : Serverless , options : AzureLoginOptions ) {
@@ -25,13 +24,39 @@ export class AzureDeployPlugin extends AzureBasePlugin<AzureLoginOptions> {
25
24
lifecycleEvents : [
26
25
"list"
27
26
]
27
+ } ,
28
+ options : {
29
+ resourceGroup : {
30
+ usage : "Resource group for the service" ,
31
+ shortcut : "g" ,
32
+ } ,
33
+ stage : {
34
+ usage : "Stage of service" ,
35
+ shortcut : "s"
36
+ } ,
37
+ region : {
38
+ usage : "Region of service" ,
39
+ shortcut : "r"
40
+ } ,
41
+ subscriptionId : {
42
+ usage : "Sets the Azure subscription ID" ,
43
+ shortcut : "i" ,
44
+ } ,
28
45
}
29
46
} ,
30
47
options : {
31
48
resourceGroup : {
32
49
usage : "Resource group for the service" ,
33
50
shortcut : "g" ,
34
51
} ,
52
+ stage : {
53
+ usage : "Stage of service" ,
54
+ shortcut : "s"
55
+ } ,
56
+ region : {
57
+ usage : "Region of service" ,
58
+ shortcut : "r"
59
+ } ,
35
60
subscriptionId : {
36
61
usage : "Sets the Azure subscription ID" ,
37
62
shortcut : "i" ,
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ import { FuncService } from "../../services/funcService";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureFuncPlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
- public commands : any ;
8
6
private service : FuncService ;
9
7
10
8
public constructor ( serverless : Serverless , options : Serverless . Options ) {
Original file line number Diff line number Diff line change
1
+ import fs from "fs" ;
1
2
import { isAbsolute , join } from "path" ;
2
3
import Serverless from "serverless" ;
3
4
import { InvokeService } from "../../services/invokeService" ;
4
- import fs from "fs" ;
5
- import { ServerlessCommandMap } from "../../models/serverless" ;
6
5
import { AzureBasePlugin } from "../azureBasePlugin" ;
7
6
8
7
export class AzureInvokePlugin extends AzureBasePlugin {
9
- public hooks : { [ eventName : string ] : Promise < any > } ;
10
- private commands : ServerlessCommandMap ;
8
+
11
9
private invokeService : InvokeService ;
10
+
12
11
public constructor ( serverless : Serverless , options : Serverless . Options ) {
13
12
super ( serverless , options ) ;
14
13
const path = this . options [ "path" ] ;
@@ -31,6 +30,22 @@ export class AzureInvokePlugin extends AzureBasePlugin {
31
30
usage : "Invoke command" ,
32
31
lifecycleEvents : [ "invoke" ] ,
33
32
options : {
33
+ resourceGroup : {
34
+ usage : "Resource group for the service" ,
35
+ shortcut : "g" ,
36
+ } ,
37
+ stage : {
38
+ usage : "Stage of service" ,
39
+ shortcut : "s"
40
+ } ,
41
+ region : {
42
+ usage : "Region of service" ,
43
+ shortcut : "r"
44
+ } ,
45
+ subscriptionId : {
46
+ usage : "Sets the Azure subscription ID" ,
47
+ shortcut : "i" ,
48
+ } ,
34
49
function : {
35
50
usage : "Function to call" ,
36
51
shortcut : "f" ,
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { AzureBasePlugin } from "../azureBasePlugin";
4
4
import { loginHooks } from "./loginHooks" ;
5
5
6
6
export class AzureLoginPlugin extends AzureBasePlugin < AzureLoginOptions > {
7
- public hooks : { [ eventName : string ] : Promise < any > } ;
8
7
9
8
public constructor ( serverless : Serverless , options : AzureLoginOptions ) {
10
9
super ( serverless , options ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import AzureProvider from "../../provider/azureProvider";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureLogsPlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
6
8
7
private provider : AzureProvider ;
9
8
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ import { OfflineService } from "../../services/offlineService";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureOfflinePlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
- public commands : any ;
8
6
private offlineService : OfflineService ;
9
7
10
8
public constructor ( serverless : Serverless , options : Serverless . Options ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ export class AzurePackagePlugin extends AzureBasePlugin {
8
8
private bindingsCreated : boolean = false ;
9
9
private packageService : PackageService ;
10
10
public provider : AzureProvider ;
11
- public hooks : { [ eventName : string ] : Promise < any > } ;
12
11
13
12
public constructor ( serverless : Serverless , options : Serverless . Options ) {
14
13
super ( serverless , options ) ;
Original file line number Diff line number Diff line change @@ -3,10 +3,37 @@ import { ResourceService } from "../../services/resourceService";
3
3
import { AzureBasePlugin } from "../azureBasePlugin" ;
4
4
5
5
export class AzureRemovePlugin extends AzureBasePlugin {
6
- public hooks : { [ eventName : string ] : Promise < any > } ;
7
6
8
7
public constructor ( serverless : Serverless , options : Serverless . Options ) {
9
8
super ( serverless , options ) ;
9
+
10
+ this . commands = {
11
+ remove : {
12
+ usage : "Remove service resource group (USE WITH CAUTION)" ,
13
+ lifecycleEvents : [
14
+ "remove"
15
+ ] ,
16
+ options : {
17
+ resourceGroup : {
18
+ usage : "Resource group for the service" ,
19
+ shortcut : "g" ,
20
+ } ,
21
+ stage : {
22
+ usage : "Stage of service" ,
23
+ shortcut : "s"
24
+ } ,
25
+ region : {
26
+ usage : "Region of service" ,
27
+ shortcut : "r"
28
+ } ,
29
+ subscriptionId : {
30
+ usage : "Sets the Azure subscription ID" ,
31
+ shortcut : "i" ,
32
+ } ,
33
+ }
34
+ }
35
+ }
36
+
10
37
this . hooks = {
11
38
"remove:remove" : this . remove . bind ( this )
12
39
} ;
Original file line number Diff line number Diff line change @@ -6,10 +6,41 @@ import { AzureBasePlugin } from "../azureBasePlugin";
6
6
* Plugin for rolling back Function App Service to previous deployment
7
7
*/
8
8
export class AzureRollbackPlugin extends AzureBasePlugin {
9
- public hooks : { [ eventName : string ] : Promise < any > } ;
10
9
11
10
public constructor ( serverless : Serverless , options : Serverless . Options ) {
12
11
super ( serverless , options ) ;
12
+
13
+ this . commands = {
14
+ rollback : {
15
+ usage : "Rollback command" ,
16
+ lifecycleEvents : [
17
+ "rollback"
18
+ ] ,
19
+ options : {
20
+ timestamp : {
21
+ usage : "Timestamp of previous deployment" ,
22
+ shortcut : "t" ,
23
+ } ,
24
+ resourceGroup : {
25
+ usage : "Resource group for the service" ,
26
+ shortcut : "g" ,
27
+ } ,
28
+ stage : {
29
+ usage : "Stage of service" ,
30
+ shortcut : "s"
31
+ } ,
32
+ region : {
33
+ usage : "Region of service" ,
34
+ shortcut : "r"
35
+ } ,
36
+ subscriptionId : {
37
+ usage : "Sets the Azure subscription ID" ,
38
+ shortcut : "i" ,
39
+ } ,
40
+ }
41
+ }
42
+ }
43
+
13
44
this . hooks = {
14
45
"rollback:rollback" : this . rollback . bind ( this )
15
46
} ;
You can’t perform that action at this time.
0 commit comments