mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 18:01:39 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
18
src/ResourceProvider/ResourceProviderClientFactory.ts
Normal file
18
src/ResourceProvider/ResourceProviderClientFactory.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IResourceProviderClientFactory, IResourceProviderClient } from "./IResourceProviderClient";
|
||||
import { ResourceProviderClient } from "./ResourceProviderClient";
|
||||
|
||||
export class ResourceProviderClientFactory implements IResourceProviderClientFactory<any> {
|
||||
private cachedClients: { [url: string]: IResourceProviderClient<any> } = {};
|
||||
|
||||
constructor(private armEndpoint: string) {}
|
||||
|
||||
public getOrCreate(url: string): IResourceProviderClient<any> {
|
||||
if (!url) {
|
||||
throw new Error("No resource provider client factory params specified");
|
||||
}
|
||||
if (!this.cachedClients[url]) {
|
||||
this.cachedClients[url] = new ResourceProviderClient(this.armEndpoint);
|
||||
}
|
||||
return this.cachedClients[url];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user