-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added cosmos arm deployment * added fix for comments * fixed undefined syntax and added comments * change array<object> to Object[] * change attemptCosmos in controller to processCosmos
- Loading branch information
Showing
11 changed files
with
353 additions
and
96 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{ | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": [ | ||
"eg2.tslint" | ||
] | ||
} | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": ["eg2.tslint"] | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"files.exclude": { | ||
"out": false // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true // set this to false to include "out" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} | ||
"files.exclude": { | ||
"out": false // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true // set this to false to include "out" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} |
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
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,18 @@ | ||
import * as fsx from "fs-extra"; | ||
|
||
export namespace ARMFileHelper { | ||
export function createOrOverwriteDir(dirPath: string): void { | ||
if (fsx.pathExistsSync(dirPath)) { | ||
fsx.removeSync(dirPath); | ||
} | ||
|
||
fsx.mkdirpSync(dirPath); | ||
} | ||
|
||
export function writeObjectToJsonFile( | ||
filePath: string, | ||
object: object | ||
): void { | ||
fsx.writeFileSync(filePath, JSON.stringify(object, null, 2), "utf-8"); | ||
} | ||
} |
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,48 @@ | ||
import ResourceManagementClient from "azure-arm-resource/lib/resource/resourceManagementClient"; | ||
import { SubscriptionItem } from "../azure-auth/azureAuth"; | ||
import { ServiceClientCredentials } from "ms-rest"; | ||
import { SubscriptionError } from "../errors"; | ||
|
||
export class ResourceManager { | ||
private AzureResourceManagementClient: ResourceManagementClient | undefined; | ||
|
||
private setClientState(userSubscriptionItem: SubscriptionItem): void { | ||
if ( | ||
this.AzureResourceManagementClient === undefined || | ||
this.AzureResourceManagementClient.subscriptionId !== | ||
userSubscriptionItem.subscriptionId | ||
) { | ||
this.AzureResourceManagementClient = this.createResourceManagementClient( | ||
userSubscriptionItem | ||
); | ||
} | ||
} | ||
|
||
private createResourceManagementClient( | ||
userSubscriptionItem: SubscriptionItem | ||
): ResourceManagementClient { | ||
let userCredentials: ServiceClientCredentials = | ||
userSubscriptionItem.session.credentials; | ||
if ( | ||
userSubscriptionItem === undefined || | ||
userSubscriptionItem.subscription === undefined || | ||
userSubscriptionItem.subscriptionId === undefined | ||
) { | ||
throw new SubscriptionError( | ||
"SubscriptionItem cannot have undefined values" | ||
); | ||
} | ||
return new ResourceManagementClient( | ||
userCredentials, | ||
userSubscriptionItem.subscriptionId, | ||
userSubscriptionItem.session.environment.resourceManagerEndpointUrl | ||
); | ||
} | ||
|
||
public getResourceManagementClient( | ||
userSubscriptionItem: SubscriptionItem | ||
): ResourceManagementClient { | ||
this.setClientState(userSubscriptionItem); | ||
return this.AzureResourceManagementClient!; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/extension/src/azure-cosmosDB/arm-templates/parameters.json
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 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": {} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/extension/src/azure-cosmosDB/arm-templates/template.json
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,55 @@ | ||
{ | ||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"location": { | ||
"type": "string" | ||
}, | ||
"locationName": { | ||
"type": "string" | ||
}, | ||
"defaultExperience": { | ||
"type": "string" | ||
}, | ||
"capabilities": { | ||
"type": "array" | ||
}, | ||
"kind": { | ||
"type": "string" | ||
} | ||
}, | ||
"variables": {}, | ||
"resources": [ | ||
{ | ||
"apiVersion": "2015-04-08", | ||
"kind": "[parameters('kind')]", | ||
"type": "Microsoft.DocumentDb/databaseAccounts", | ||
"name": "[parameters('name')]", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"databaseAccountOfferType": "Standard", | ||
"locations": [ | ||
{ | ||
"id": "[concat(parameters('name'), '-', parameters('location'))]", | ||
"failoverPriority": 0, | ||
"locationName": "[parameters('locationName')]" | ||
} | ||
], | ||
"enableMultipleWriteLocations": true, | ||
"isVirtualNetworkFilterEnabled": false, | ||
"virtualNetworkRules": [], | ||
"ipRangeFilter": "", | ||
"dependsOn": [], | ||
"capabilities": "[parameters('capabilities')]" | ||
}, | ||
"tags": { | ||
"defaultExperience": "[parameters('defaultExperience')]", | ||
"generatedBy": "Web Template Studio" | ||
} | ||
} | ||
], | ||
"outputs": {} | ||
} |
Oops, something went wrong.