Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async get_endpoint(nsName: 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.get(resource_group, nsName);
// client.namespaces.listKeys(resource_group,)
return response.serviceBusEndpoint || "";
}
public async get_secondary_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.secondaryConnectionString || "";
}
}
public async get_secondary_key(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.secondaryKey || "";
}
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 || "";
}
public async get_primary_key(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.primaryKey || "";
}
constructor(clientId, clientSecret, tenantId, subscriptionId) {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.tenantId = tenantId;
this.subscriptionId = subscriptionId;
this.classList = new Map();
this.classList.set('WebSiteManagementClient', WebSiteManagementClient);
this.classList.set('ResourceManagementClient', ResourceManagementClient);
this.classList.set('StorageManagementClient', StorageManagementClient);
this.classList.set('ApiManagementClient', ApiManagementClient);
this.classList.set('CdnManagementClient', CdnManagementClient);
this.classList.set('CosmosDBManagementClient', CosmosDBManagementClient);
this.classList.set('EventHubManagementClient', EventHubManagementClient);
this.classList.set('ServiceBusManagementClient', ServiceBusManagementClient);
this.instanceList = new Map();
}
constructor(name: string, ingredient: IIngredient, ctx: DeploymentContext) {
super(name, ingredient, ctx);
this._sbmClient = new ServiceBusManagementClient(this._ctx.AuthToken, this._ctx.Environment.authentication.subscriptionId);
}