All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyuncs.regions.CustomizedEndpointsParser Maven / Gradle / Ivy

package com.aliyuncs.regions;

import com.aliyuncs.auth.Credential;
import com.aliyuncs.exceptions.ClientException;

import java.util.*;

public class CustomizedEndpointsParser implements IEndpointsProvider {
    private List endpoints;

    public void setEndpoints(List endpoints) {
        this.endpoints = endpoints;
    }

    @Override
    public List getEndpoints() throws ClientException {
        return this.endpoints;
    }

    @Override
    public List getEndpoints(String region, String product, String endpointType, Credential credential,
                                       LocationConfig locationConfig) throws ClientException {
        throw new UnsupportedOperationException();
    }

    public static CustomizedEndpointsParser initParser(String regionId, Map productDomainMap) {
        CustomizedEndpointsParser parser = new CustomizedEndpointsParser();
        if (regionId == null || regionId.length() == 0 || productDomainMap == null) {
            return null;
        }
        Set regionIds = new HashSet();
        regionIds.add(regionId);
        List productDomainList = new ArrayList();
        for (String productName : productDomainMap.keySet()) {
            productDomainList.add(new ProductDomain(productName, productDomainMap.get(productName)));
        }
        Endpoint endpoint = new Endpoint(regionId, regionIds, productDomainList);

        parser.setEndpoints(Arrays.asList(endpoint));
        return parser;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy