-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Adds 3 ingredients for web apps (webapp, traffic manager, custom…
… hostnames with ssl), teaches core-utils how to recognize a primary region, and cleans up boilerplate code for deploying arm templates through ingredients into a helper package.
- Loading branch information
1 parent
57f8e29
commit 0304458
Showing
51 changed files
with
4,033 additions
and
1,746 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
src/ | ||
.vscode/ | ||
package/ | ||
test/ | ||
*.tgz | ||
tsconfig.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,4 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
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,110 @@ | ||
## Changelogs | ||
* [@azbake/arm-helper](./CHANGELOG.md) | ||
|
||
## Overview | ||
|
||
ARM Helper is a utility plugin for Bake that can be used by ingredients to easily deploy ARM templates. | ||
|
||
## Usage | ||
|
||
To use, install the utility as a dependency for your ingredient. | ||
|
||
```bash | ||
npm i @azbake/arm-helper | ||
``` | ||
|
||
## ARMHelper class | ||
|
||
Class for deploying ARM templates and transforming bake parameters into ARM template parameters. | ||
|
||
### Constructors | ||
|
||
ARMHelper(context) | ||
|
||
### Functions | ||
|
||
|function|description| | ||
|--------|-----------| | ||
|DeployTemplate(deploymentName, template, params, resourceGroup)| Deploys the specified ARM template with the specified parameters.| | ||
|BakeParamsToARMParams(deploymentName, params)| Converts bake parameters to the format expected by ARM for ARM parameters.| | ||
|
||
### Constructor Details | ||
|
||
#### ARMHelper(context) | ||
|
||
```typescript | ||
new ARMHelper(context) | ||
``` | ||
|
||
##### Parameters | ||
|parameter|type|required|description| | ||
|---------|----|--------|-----------| | ||
|``context``|DeploymentContext|yes|The current bake deployment context| | ||
|
||
### Function Details | ||
|
||
#### DeployTemplate(deploymentName, template, params, resourceGroup) | ||
|
||
Deploys the specified ARM template with the specified parameters to the specified resourceGroup. This is a long running function and should be used with the ``await`` operator. | ||
|
||
```typescript | ||
public async DeployTemplate(deploymentName, template, params, resourceGroup) | ||
``` | ||
|
||
##### Parameters | ||
|parameter|type|required|description| | ||
|---------|----|--------|-----------| | ||
|``deploymentName``|string|yes|Name of the deployment for Azure.| | ||
|``template``|any|yes|JSON object representing the arm template| | ||
|``params``|any|yes|JSON object representing parameters used in the ARM template| | ||
|``resourceGroup``|string|yes|Name of the resource group the ARM template will deploy into| | ||
|
||
##### Returns | ||
``Promise<void>`` | ||
|
||
#### BakeParamsToARMParams(deploymentName, params) | ||
|
||
Reads the Bake parameters and converts them into values acceptable for parameters of ARM templates. | ||
|
||
```typescript | ||
public BakeParamsToARMParams(deploymentName, params) | ||
``` | ||
|
||
##### Parameters | ||
|parameter|type|required|description| | ||
|---------|----|--------|-----------| | ||
|``deploymentName``|string|yes|Name of the azure deployment| | ||
|``params``|``Map<string, BakeVariable>``|yes|The parameters passed into the ingredient| | ||
|
||
##### Returns | ||
``any`` | ||
|
||
JSON object of parameters to load into the ARM template during deployment. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## Example | ||
|
||
```typescript | ||
import { BaseIngredient, IngredientManager } from "@azbake/core" | ||
import { ARMHelper } from "@azbake/arm-helper" | ||
import arm from "./arm.json" | ||
|
||
export class MyIngredient extends BaseIngredient { | ||
|
||
public async Execute(): Promise<void> { | ||
|
||
const util = IngredientManager.getIngredientFunction("coreutils", this._ctx) | ||
const helper = new ARMHelper(this._ctx) | ||
|
||
const parameters = helper.BakeParamsToARMParams(this._name, this._ingredient.properties.parameters) | ||
|
||
await helper.DeployTemplate(this._name, arm, parameters, util.resource_group()) | ||
} | ||
} | ||
|
||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@azbake/arm-helper", | ||
"description": "Helper class for installing ARM templates through Bake.", | ||
"version": "0.0.1", | ||
"main": "dist/arm-helper.js", | ||
"author": "HCHB", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/HomecareHomebase/azure-bake.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/HomecareHomebase/azure-bake/issues" | ||
}, | ||
"homepage": "https://github.com/HomecareHomebase/azure-bake", | ||
"scripts": { | ||
"upload": "tsc -p ./src && npm --no-git-tag-version version patch && npm publish --access public", | ||
"compile": "tsc", | ||
"watch": "tsc -w -p ./src" | ||
}, | ||
"peerDependencies": { | ||
"@azbake/core": "0.*", | ||
"@azure/arm-resources": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^10.12.18" | ||
}, | ||
"dependencies": { | ||
"@azure/arm-resources": "^1.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.