netana-20201016/main.tea (89 lines of code) (raw):
/**
*
*/
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;
extends OpenApi;
init(config: OpenApi.Config){
super(config);
@endpointRule = 'regional';
checkConfig(config);
@endpoint = getEndpoint('netana', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}
function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
if (!Util.empty(endpoint)) {
return endpoint;
}
if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
return endpointMap[regionId];
}
return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model ListIpGeolocationsRequest {
countryCode?: string(name='CountryCode'),
cityCode?: string(name='CityCode'),
ipv4Prefix?: string(name='Ipv4Prefix'),
resourcePoolName?: string(name='ResourcePoolName'),
nextToken?: string(name='NextToken'),
maxResults?: int32(name='MaxResults'),
ownerId?: long(name='OwnerId'),
resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
resourceOwnerId?: long(name='ResourceOwnerId'),
ownerAccount?: string(name='OwnerAccount'),
}
model ListIpGeolocationsResponseBody = {
ipGeolocationModels?: {
ipGeolocationModel?: [
{
cityCode?: string(name='CityCode'),
resourcePoolName?: string(name='ResourcePoolName'),
countryCode?: string(name='CountryCode'),
ipv4Prefix?: string(name='Ipv4Prefix'),
}
](name='IpGeolocationModel')
}(name='IpGeolocationModels'),
totalCount?: int32(name='TotalCount'),
nextToken?: string(name='NextToken'),
requestId?: string(name='RequestId'),
maxResults?: int32(name='MaxResults'),
}
model ListIpGeolocationsResponse = {
headers: map[string]string(name='headers'),
body: ListIpGeolocationsResponseBody(name='body'),
}
async function listIpGeolocationsWithOptions(request: ListIpGeolocationsRequest, runtime: Util.RuntimeOptions): ListIpGeolocationsResponse {
Util.validateModel(request);
var query = {};
query["CountryCode"] = request.countryCode;
query["CityCode"] = request.cityCode;
query["Ipv4Prefix"] = request.ipv4Prefix;
query["ResourcePoolName"] = request.resourcePoolName;
query["NextToken"] = request.nextToken;
query["MaxResults"] = request.maxResults;
query["OwnerId"] = request.ownerId;
query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
query["ResourceOwnerId"] = request.resourceOwnerId;
query["OwnerAccount"] = request.ownerAccount;
var req = new OpenApi.OpenApiRequest{
query = OpenApiUtil.query(query),
body = Util.toMap(request),
};
var params = new OpenApi.Params{
action = 'ListIpGeolocations',
version = '2020-10-16',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'json',
bodyType = 'json',
};
return callApi(params, req, runtime);
}
async function listIpGeolocations(request: ListIpGeolocationsRequest): ListIpGeolocationsResponse {
var runtime = new Util.RuntimeOptions{};
return listIpGeolocationsWithOptions(request, runtime);
}