-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [BOOST-652] - Implement skeleton for azure-infrastructure * [BOOST-652] - Implement skeleton for azure-infrastructure * [BOOST-652] - Addressed some comments. * Added more Azure resources Templates for Function App and API Management were added * More Azure resources for REST API The necessary resources have been added to make a request to the /graphql endpoint * Azure adapters for API and GraphQL * Cosmos DB added to infrastructure * Implemented events adapter * Implemented read model and searcher adapter * Unit tests for Azure provider * Refactored Azure provider infrastructure * Some fixes to the events and read model adapters * Several fixes after merging with master-mirror * Fixed yarn.lock * Cleaned up utils.ts in the Azure infra package * Added @ts-ignore to conflicting lines Some dependencies screwed up the types used for stubs and spies with Sinon. Momentarily @ts-ignore was added to these lines but a better way to handle these types must be found. * Set template paths as class-level constants * Refactored template loading in Azure infra * Fixed debug message placement in searcher-adapter * Pass Azure credentials as function parameters * Small string change in searcher-adapter * Use path.join in packageAzureFunction method * Refactored contants.ts to resemble AWS provider * Removed unnecessary type conversion * Simplified returns in the events adapter Co-authored-by: Rodrigo <rodrigo@theagilemonkeys.com>
- Loading branch information
Showing
38 changed files
with
3,232 additions
and
717 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
125 changes: 125 additions & 0 deletions
125
...ramework-provider-azure-infrastructure/src/infrastructure/arm-templates/api-management.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,125 @@ | ||
export const template = { | ||
$schema: 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#', | ||
contentVersion: '1.0.0.0', | ||
parameters: { | ||
publisherEmail: { | ||
type: 'string', | ||
minLength: 1, | ||
metadata: { | ||
description: 'The email address of the owner of the service', | ||
}, | ||
}, | ||
publisherName: { | ||
type: 'string', | ||
minLength: 1, | ||
metadata: { | ||
description: 'The name of the owner of the service', | ||
}, | ||
}, | ||
sku: { | ||
type: 'string', | ||
allowedValues: ['Consumption', 'Developer', 'Standard', 'Premium'], | ||
defaultValue: 'Consumption', | ||
metadata: { | ||
description: 'The pricing tier of this API Management service', | ||
}, | ||
}, | ||
skuCount: { | ||
type: 'int', | ||
allowedValues: [0, 1, 2], | ||
defaultValue: 0, | ||
metadata: { | ||
description: 'The instance size of this API Management service.', | ||
}, | ||
}, | ||
location: { | ||
type: 'string', | ||
defaultValue: '[resourceGroup().location]', | ||
metadata: { | ||
description: 'Location for all resources.', | ||
}, | ||
}, | ||
apiName: { | ||
type: 'string', | ||
}, | ||
apiDisplayName: { | ||
type: 'string', | ||
}, | ||
apiPath: { | ||
type: 'string', | ||
}, | ||
policy: { | ||
type: 'string', | ||
}, | ||
}, | ||
variables: { | ||
apiManagementServiceName: "[concat('apiservice', uniqueString(resourceGroup().id))]", | ||
}, | ||
resources: [ | ||
{ | ||
apiVersion: '2019-12-01', | ||
name: "[variables('apiManagementServiceName')]", | ||
type: 'Microsoft.ApiManagement/service', | ||
location: "[parameters('location')]", | ||
tags: {}, | ||
sku: { | ||
name: "[parameters('sku')]", | ||
capacity: "[parameters('skuCount')]", | ||
}, | ||
properties: { | ||
publisherEmail: "[parameters('publisherEmail')]", | ||
publisherName: "[parameters('publisherName')]", | ||
}, | ||
resources: [ | ||
{ | ||
name: "[parameters('apiName')]", | ||
type: 'apis', | ||
dependsOn: ["[concat('Microsoft.ApiManagement/service/', variables('apiManagementServiceName'))]"], | ||
apiVersion: '2019-12-01', | ||
properties: { | ||
path: "[parameters('apiPath')]", | ||
displayName: "[parameters('apiDisplayName')]", | ||
protocols: ['http', 'https'], | ||
subscriptionRequired: false, | ||
}, | ||
resources: [ | ||
{ | ||
apiVersion: '2017-03-01', | ||
type: 'operations', | ||
name: 'graphqlPOST', | ||
dependsOn: [ | ||
"[concat('Microsoft.ApiManagement/service/', variables('apiManagementServiceName'), '/apis/', parameters('apiName'))]", | ||
], | ||
properties: { | ||
displayName: '/graphql', | ||
method: 'POST', | ||
urlTemplate: '/graphql', | ||
}, | ||
resources: [ | ||
{ | ||
apiVersion: '2017-03-01', | ||
type: 'policies', | ||
name: 'policy', | ||
dependsOn: [ | ||
"[concat('Microsoft.ApiManagement/service/', variables('apiManagementServiceName'))]", | ||
"[concat('Microsoft.ApiManagement/service/', variables('apiManagementServiceName'), '/apis/', parameters('apiName'))]", | ||
"[concat('Microsoft.ApiManagement/service/', variables('apiManagementServiceName'), '/apis/', parameters('apiName'), '/operations/graphqlPOST')]", | ||
], | ||
properties: { | ||
policyContent: "[parameters('policy')]", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
outputs: { | ||
apiManagementServiceName: { | ||
type: 'string', | ||
value: "[variables('apiManagementServiceName')]", | ||
}, | ||
}, | ||
} |
84 changes: 84 additions & 0 deletions
84
...ework-provider-azure-infrastructure/src/infrastructure/arm-templates/cosmos-db-account.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,84 @@ | ||
export const template = { | ||
$schema: 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#', | ||
contentVersion: '1.0.0.0', | ||
parameters: { | ||
cosmosDbAccountName: { | ||
type: 'string', | ||
defaultValue: '[uniqueString(resourceGroup().id)]', | ||
}, | ||
defaultExperience: { | ||
type: 'string', | ||
defaultValue: 'Core (SQL)', | ||
}, | ||
databaseName: { | ||
type: 'string', | ||
}, | ||
}, | ||
functions: [], | ||
variables: { | ||
resourceId: "[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbAccountName'))]", | ||
apiVersion: "[providers('Microsoft.DocumentDB', 'databaseAccounts').apiVersions[0]]", | ||
}, | ||
resources: [ | ||
{ | ||
name: "[parameters('cosmosDbAccountName')]", | ||
type: 'Microsoft.DocumentDB/databaseAccounts', | ||
apiVersion: '2019-12-12', | ||
location: '[resourceGroup().location]', | ||
tags: { | ||
defaultExperience: "[parameters('defaultExperience')]", | ||
'hidden-cosmos-mmspecial': '', | ||
CosmosAccountType: 'Non-Production', | ||
}, | ||
kind: 'GlobalDocumentDB', | ||
properties: { | ||
databaseAccountOfferType: 'Standard', | ||
locations: [ | ||
{ | ||
id: "[concat(parameters('cosmosDbAccountName'), '-', resourceGroup().location)]", | ||
locationName: '[resourceGroup().location]', | ||
failoverPriority: 0, | ||
}, | ||
], | ||
enableMultipleWriteLocations: false, | ||
isVirtualNetworkFilterEnabled: false, | ||
virtualNetworkRules: [], | ||
ipRangeFilter: '', | ||
dependsOn: [], | ||
capabilities: [], | ||
enableFreeTier: true, | ||
}, | ||
resources: [ | ||
{ | ||
type: 'Microsoft.DocumentDB/databaseAccounts/apis/databases', | ||
name: "[concat(parameters('cosmosDbAccountName'), '/sql/', parameters('databaseName'))]", | ||
apiVersion: '2016-03-31', | ||
dependsOn: ["[resourceId('Microsoft.DocumentDB/databaseAccounts/', parameters('cosmosDbAccountName'))]"], | ||
properties: { | ||
resource: { | ||
id: "[parameters('databaseName')]", | ||
}, | ||
options: { | ||
throughput: 400, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
outputs: { | ||
documentEndpoint: { | ||
type: 'string', | ||
value: "[reference(variables('resourceId'), variables('apiVersion')).documentEndpoint]", | ||
}, | ||
accountKey: { | ||
type: 'string', | ||
value: "[listKeys(variables('resourceId'), variables('apiVersion')).primaryMasterKey]", | ||
}, | ||
connectionString: { | ||
type: 'string', | ||
value: | ||
"[concat('AccountEndpoint=https://', parameters('cosmosDbAccountName'), '.documents.azure.com:443/;AccountKey=', listKeys(variables('resourceId'), variables('apiVersion')).primaryMasterKey, ';')]", | ||
}, | ||
}, | ||
} |
Oops, something went wrong.