import{get as e}from"@clevercloud/client/esm/api/v2/addon.js";import{ONE_SECOND as r}from"@clevercloud/client/esm/with-cache.js";import{sendToApi as d}from"./lib/send-to-api.js";class i{constructor({apiConfig:e,ownerId:r,addonId:d,providerId:i,signal:o}){this._apiConfig=e,this._ownerId=r,this._addonId=d,this._providerId=i,this._realId=null,this._signal=o}_getAddon(){return e({id:this._ownerId,addonId:this._addonId}).then(d({apiConfig:this._apiConfig,signal:this._signal,cacheDelay:r}))}_getOperator(e){return(i={providerId:this._providerId,realId:e},Promise.resolve({method:"get",url:`/v4/addon-providers/addon-${i.providerId}/addons/${i.realId}`,headers:{Accept:"application/json"}})).then(d({apiConfig:this._apiConfig,signal:this._signal,cacheDelay:r}));var i}async getAddonWithOperator(){const e=await this._getAddon(),r=await this._getOperator(e.realId);return this._realId=e.realId,this._providerId=e.provider.id,r}createNg(){return function({providerId:e,realId:r}){return Promise.resolve({method:"post",url:`/v4/addon-providers/addon-${e}/addons/${r}/networkgroup`,headers:{Access:"application/json"}})}({providerId:this._providerId,realId:this._realId}).then(d({apiConfig:this._apiConfig}))}deleteNg(){return function({providerId:e,realId:r}){return Promise.resolve({method:"delete",url:`/v4/addon-providers/addon-${e}/addons/${r}/networkgroup`,headers:{Access:"application/json"}})}({providerId:this._providerId,realId:this._realId}).then(d({apiConfig:this._apiConfig}))}}export{i as CcAddonCredentialsBetaClient};
//# sourceMappingURL=cc-addon-credentials-beta.client.js.map
