0.1.110 • Published 1 year ago

@azbake/arm-helper v0.1.110

Weekly downloads
599
License
MIT
Repository
github
Last release
1 year ago

Changelogs

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.

  npm i @azbake/arm-helper

ARMHelper class

Class for deploying ARM templates and transforming bake parameters into ARM template parameters.

Constructors

ARMHelper(context)

Functions

functiondescription
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)

new ARMHelper(context)
Parameters
parametertyperequireddescription
contextDeploymentContextyesThe 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.

public async DeployTemplate(deploymentName, template, params, resourceGroup)
Parameters
parametertyperequireddescription
deploymentNamestringyesName of the deployment for Azure.
templateanyyesJSON object representing the arm template
paramsanyyesJSON object representing parameters used in the ARM template
resourceGroupstringyesName 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.

public BakeParamsToARMParams(deploymentName, params)
Parameters
parametertyperequireddescription
deploymentNamestringyesName of the azure deployment
paramsMap<string, BakeVariable>yesThe parameters passed into the ingredient
Returns

any

JSON object of parameters to load into the ARM template during deployment.

Example

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 = await helper.BakeParamsToARMParamsAsync(this._name, this._ingredient.properties.parameters)

    await helper.DeployTemplate(this._name, arm, parameters, await util.resource_group())
  }
}
0.1.110

1 year ago

0.1.107

2 years ago

0.1.106

2 years ago

0.1.109

2 years ago

0.1.108

2 years ago

0.1.105

2 years ago

0.1.104

4 years ago

0.1.103

4 years ago

0.1.102

4 years ago

0.1.101

4 years ago

0.1.100

4 years ago

0.1.99

4 years ago

0.1.98

4 years ago

0.1.97

4 years ago

0.1.96

4 years ago

0.1.95

4 years ago

0.1.87

4 years ago

0.1.75

5 years ago

0.1.68

5 years ago

0.1.67

5 years ago

0.1.64

5 years ago

0.1.61

5 years ago

0.1.59

5 years ago

0.1.55

5 years ago

0.1.47

5 years ago

0.1.46

5 years ago

0.1.45

5 years ago

0.1.44

5 years ago

0.1.43

5 years ago

0.1.42

5 years ago

0.1.38

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.30

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.22

5 years ago

0.0.2

5 years ago