How to use @azbake/core - 10 common examples

To help you get started, we’ve selected a few @azbake/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HomecareHomebase / azure-bake / ingredient / ingredient-traffic-manager / src / plugin.ts View on Github external
public async DeployEndpoint(): Promise {
        
        try {
            let util = IngredientManager.getIngredientFunction("coreutils", this._ctx);
            const region = this._ctx.Region.code;
            let trfutil = new TrafficUtils(this._ctx);

            // read parameters to get the source-type.
            let temp: any = {};
            for ( const[n,v] of this._ingredient.properties.parameters){
                temp[n] = {
                    "value": await v.valueAsync(this._ctx)
                };
            }

            let props: any = {};

            const profileName = trfutil.get_profile();
            const epName = util.create_resource_name("ep", null, true);
github HomecareHomebase / azure-bake / ingredient / ingredient-traffic-manager / src / plugin.ts View on Github external
public async Execute(): Promise {

        let util = IngredientManager.getIngredientFunction("coreutils", this._ctx);

        try {
            // deploy the traffic manager profile to the primary region only
            if (util.current_region_primary()) {
                await this.DeployProfile();
            }

            await this.DeployEndpoint();

        } catch(error){
            this._logger.error(`deployment failed: ${error}`);
            throw error;
        }
    }
github HomecareHomebase / azure-bake / ingredient / ingredient-availability-set / src / functions.ts View on Github external
public async get_update_domain_count(): Promise {
        
        let util = IngredientManager.getIngredientFunction("coreutils", this.context);
        let client = new ResourceManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);

        let availResource = await client.resources.get(await util.resource_group(), "Microsoft.Compute", "", "availabilitySets", name, "2018-06-01");

        return availResource.properties.platformUpdateDomainCount;
    }
}
github HomecareHomebase / azure-bake / ingredient / ingredient-network-interface / src / functions.ts View on Github external
public async get_mac_address(nicName: string, rg: string | null = null) { 
        
        let util = IngredientManager.getIngredientFunction("coreutils", this.context);
        let resource_group = rg || await util.resource_group();

        const client = new NetworkManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);                
        let response = await client.networkInterfaces.get( resource_group, nicName)                      
        return response.macAddress;
    }   
    public async get_ip_configurations(nicName: string, rg: string | null = null) {
github HomecareHomebase / azure-bake / ingredient / ingredient-service-bus-namespace / src / functions.ts View on Github external
public async get_primary_connection_string(nsName: string, authRuleName: string, rg: string | null = null) : Promise {

        let util = IngredientManager.getIngredientFunction("coreutils", this.context);
        let resource_group = rg || await util.resource_group();

        const client = new ServiceBusManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);

        let response = await client.namespaces.listKeys(resource_group, nsName, authRuleName);

        return response.primaryConnectionString || "";
    }
github HomecareHomebase / azure-bake / ingredient / ingredient-key-vault / src / functions.ts View on Github external
public create_resource_name(): string {
        let util = IngredientManager.getIngredientFunction("coreutils", this.context);

        const name = util.create_resource_name("keyvault", null, true);
        return name;
    }
github HomecareHomebase / azure-bake / ingredient / ingredient-storage / src / functions.ts View on Github external
public async get_secondary_key(name: string, rg: string | null = null) : Promise {
     
        let util = IngredientManager.getIngredientFunction("coreutils", this.context)
        let resource_group = rg || await util.resource_group()

        const client = new StorageManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);

        let response = await client.storageAccounts.listKeys(resource_group, name)

        let key: string = ""
        if (response.keys)
        {
            key = response.keys[1].value || ""
        }
        return key
    }
github HomecareHomebase / azure-bake / ingredient / ingredient-kubernetes / src / plugin.ts View on Github external
public async Execute(): Promise {

        //k8s only executes against the primary/first region.. ignore all other regions
        let util = IngredientManager.getIngredientFunction("coreutils", this._ctx);
        if (!util.current_region_primary()) {
            return
        }

        const kubeconfigFilename = Math.random().toString(36).substring(7) + '.yaml'
        try {
            let k8sYamlPath = await this._ingredient.properties.source.valueAsync(this._ctx);
            if (!await promisify(fs.exists)(k8sYamlPath)) {
                throw "file/path not found: " + k8sYamlPath
            }
            await this.replaceTokens(k8sYamlPath);
            let testDeployment = this._ingredient.properties.parameters.get("testDeployment");
            let kubeConfigParam = await this.getKubeConfigParameter(kubeconfigFilename);
            try {
                let { stdout } = await exec(`kubectl apply ${kubeConfigParam} -f ${k8sYamlPath}`);
                this._logger.log(`${stdout}`);
github HomecareHomebase / azure-bake / ingredient / ingredient-event-hub-namespace / src / functions.ts View on Github external
public get_resource_name(shortName: string | null = null): string {
        let util = IngredientManager.getIngredientFunction("coreutils", this.context)

        //resource type, name, region enabled
        const fullName = util.create_resource_name("ehn", shortName, true);

        this.context._logger.debug(`EventHubNamespaceUtils.get_resource_name() returned ${fullName}`);

        return fullName;
    }
github HomecareHomebase / azure-bake / ingredient / ingredient-api-managment-base / src / plugin.ts View on Github external
public async Execute(): Promise {
        try {
            this._logger.log(`API Manamgement: Base Logging - ${this._ingredient.properties.source}`)
            let aiClient = new ApplicationInsightsManagementClient(this._ctx.AuthToken, this._ctx.Environment.authentication.subscriptionId);
            let client = new ApiManagementClient(this._ctx.AuthToken, this._ctx.Environment.authentication.subscriptionId)
            let util = IngredientManager.getIngredientFunction("coreutils", this._ctx)
            const helper = new ARMHelper(this._ctx);
            let params = await helper.BakeParamsToARMParamsAsync(this._name, this._ingredient.properties.parameters)
            let serviceName = params["apiManagementServiceName"].value
            //Import deployment parameters
            let properties = params["properties"]
            delete params["properties"]
            let loggerProps = params["logger"]
            delete params["logger"]
            
            params = await helper.ConfigureDiagnostics(params);
            //Deploy primary ARM template
            await helper.DeployTemplate(this._name, ApimTemplate, params, await util.resource_group())
            //Deploy named Key/Value pairs
            if (properties) {
                let keys = Object.keys(properties.value)
                let apimRg = await util.resource_group() || ""

@azbake/core

core bake library to integrate 3rd party ingredients into the system

MIT
Latest version published 5 months ago

Package Health Score

64 / 100
Full package analysis

Similar packages