-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(amazon): prepare amazon for library build
- Loading branch information
1 parent
bd97d09
commit a050ddb
Showing
28 changed files
with
132 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface IKeyPair { | ||
account: string; | ||
region: string; | ||
keyName: string; | ||
keyFingerprint: string; | ||
} |
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 @@ | ||
export * from './IKeyPair'; |
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,5 @@ | ||
export * from './domain'; | ||
|
||
export * from './keyPairs'; | ||
|
||
export * from './vpc'; |
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 @@ | ||
export * from './keyPairs.read.service'; |
22 changes: 0 additions & 22 deletions
22
app/scripts/modules/amazon/keyPairs/keyPairs.read.service.js
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
app/scripts/modules/amazon/keyPairs/keyPairs.read.service.ts
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,20 @@ | ||
import { module, IPromise } from 'angular'; | ||
|
||
import { API_SERVICE, Api } from '@spinnaker/core'; | ||
|
||
import { IKeyPair } from 'amazon/domain'; | ||
|
||
export class KeyPairsReader { | ||
|
||
constructor(private API: Api) { | ||
'ngInject'; | ||
} | ||
|
||
public listKeyPairs(): IPromise<IKeyPair[]> { | ||
return this.API.all('keyPairs').useCache().getList() | ||
.then((keyPairs: IKeyPair[]) => keyPairs.sort((a, b) => a.keyName.localeCompare(b.keyName))); | ||
} | ||
} | ||
|
||
export const KEY_PAIRS_READ_SERVICE = 'spinnaker.amazon.keyPairs.read.service'; | ||
module(KEY_PAIRS_READ_SERVICE, [API_SERVICE]).service('keyPairsReader', KeyPairsReader); |
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
5 changes: 3 additions & 2 deletions
5
app/scripts/modules/amazon/serverGroup/serverGroup.transformer.js
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 @@ | ||
export * from './vpc.read.service'; |
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 was deleted.
Oops, something went wrong.
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,46 @@ | ||
import { module, IQService, IPromise } from 'angular'; | ||
|
||
import { IVpc, NETWORK_READ_SERVICE, NetworkReader } from '@spinnaker/core'; | ||
|
||
export class VpcReader { | ||
|
||
private cachedVpcs: IVpc[]; | ||
|
||
constructor(private $q: IQService, private networkReader: NetworkReader) { | ||
'ngInject'; | ||
} | ||
|
||
public listVpcs(): IPromise<IVpc[]> { | ||
if (this.cachedVpcs) { | ||
return this.$q.when(this.cachedVpcs); | ||
} | ||
return this.networkReader.listNetworksByProvider('aws').then((vpcs: IVpc[]) => { | ||
const results = vpcs.map(vpc => { | ||
vpc.label = vpc.name; | ||
vpc.deprecated = !!vpc.deprecated; | ||
if (vpc.deprecated) { | ||
vpc.label += ' (deprecated)'; | ||
} | ||
return vpc; | ||
}); | ||
this.cachedVpcs = results; | ||
return results; | ||
}); | ||
} | ||
|
||
public resetCache() { | ||
this.cachedVpcs = null; | ||
} | ||
|
||
public getVpcName(id: string) { | ||
return this.listVpcs().then(vpcs => { | ||
const match = vpcs.find(test => { | ||
return test.id === id; | ||
}); | ||
return match ? match.name : null; | ||
}); | ||
} | ||
} | ||
|
||
export const VPC_READ_SERVICE = 'spinnaker.amazon.vpc.read.service'; | ||
module(VPC_READ_SERVICE, [NETWORK_READ_SERVICE]).service('vpcReader', VpcReader); |
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
Oops, something went wrong.