MCPcopy Index your code
hub / github.com/scality/cloudserver / getAzureStorageAccountName

Method getAzureStorageAccountName

lib/Config.js:2119–2147  ·  view source on GitHub ↗
(locationConstraint)

Source from the content-addressed store, hash-verified

2117 }
2118
2119 getAzureStorageAccountName(locationConstraint) {
2120 const accountName = azureGetStorageAccountName(
2121 locationConstraint,
2122 this.locationConstraints[locationConstraint].details
2123 );
2124 if (accountName) {
2125 return accountName;
2126 }
2127
2128 // For SAS & ServicePrincipal, retrieve the accountName from the endpoint
2129 const endpoint = this.getAzureEndpoint(locationConstraint);
2130 const url = new URL(endpoint);
2131 const fragments = url.hostname.split('.', 3);
2132 if (fragments.length === 3 && fragments[1] === 'blob') {
2133 return fragments[0];
2134 }
2135
2136 // We should always reach here, though it may not be the case for "mock" servers,
2137 // where the accoutName is in the path
2138 const path = url.pathname.replace(/^\//, '').replace(/\/$/, '');
2139 if (path) {
2140 return path;
2141 }
2142
2143 // We should not reach here; if that happens, use the endpoint itself, which
2144 // should be close-enough since this function is used for detecting when two
2145 // locations actually point to the same account
2146 return endpoint;
2147 }
2148
2149 getAzureStorageCredentials(locationConstraint) {
2150 return azureGetLocationCredentials(

Callers 2

isSameAzureAccountMethod · 0.95
Config.jsFile · 0.80

Calls 2

getAzureEndpointMethod · 0.95

Tested by

no test coverage detected