You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could not find how to get a single instance using the api in the documentation. I am now fetching all instances and making a filter function to retrieve one instance, which is not optimal.
/** * @param {{ * instancePrefix: string; * region: string; * }} param0 * @returns {Promise< * { * name: string | undefined; * id: string | undefined; * status: string | undefined; * ip: string | undefined; * }[] * >} */asyncgetInstancesFromProvider({ instancePrefix, region }){try{consttoken=awaitgetOSToken();// get current regionconsturl_splitted=config.openstack.servers_url.split(".");url_splitted[1]=region.toLowerCase();consturl=url_splitted.join(".");constheaders={"X-Auth-Token": token,};constresponse=awaitaxios.get(url,{ headers });// get instances arrayletinstances=response.data.servers;// format return outputinstances=this.processInstancesFromOpenstack(instances);// retrive one instance using js filter function :/letinstancesOS=instances.filter((instanceOS)=>instanceOS.name.includes(instancePrefix));returninstancesOS;}catch(error){console.log(error);thrownewCustomApiError("ovh.get-instances-error",{originalError: error,});}}
How t get single instance details?
I could not find how to get a single instance using the api in the documentation. I am now fetching all instances and making a filter function to retrieve one instance, which is not optimal.
config
The text was updated successfully, but these errors were encountered: