/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('yundun-dbaudit', @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 ClearInstanceStorageRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  storageSpace?: string(name='StorageSpace'),
  storageCategory?: string(name='StorageCategory'),
}

model ClearInstanceStorageResponseBody = {
  requestId?: string(name='RequestId'),
}

model ClearInstanceStorageResponse = {
  headers: map[string]string(name='headers'),
  body: ClearInstanceStorageResponseBody(name='body'),
}

async function clearInstanceStorageWithOptions(request: ClearInstanceStorageRequest, runtime: Util.RuntimeOptions): ClearInstanceStorageResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ClearInstanceStorage', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function clearInstanceStorage(request: ClearInstanceStorageRequest): ClearInstanceStorageResponse {
  var runtime = new Util.RuntimeOptions{};
  return clearInstanceStorageWithOptions(request, runtime);
}

model ConfigInstanceWhiteListRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  ipVersion?: string(name='IpVersion'),
  whiteList?: [ string ](name='WhiteList'),
}

model ConfigInstanceWhiteListResponseBody = {
  requestId?: string(name='RequestId'),
}

model ConfigInstanceWhiteListResponse = {
  headers: map[string]string(name='headers'),
  body: ConfigInstanceWhiteListResponseBody(name='body'),
}

async function configInstanceWhiteListWithOptions(request: ConfigInstanceWhiteListRequest, runtime: Util.RuntimeOptions): ConfigInstanceWhiteListResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ConfigInstanceWhiteList', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function configInstanceWhiteList(request: ConfigInstanceWhiteListRequest): ConfigInstanceWhiteListResponse {
  var runtime = new Util.RuntimeOptions{};
  return configInstanceWhiteListWithOptions(request, runtime);
}

model DescribeAuditLogsRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  startTime?: string(name='StartTime'),
  endTime?: string(name='EndTime'),
  currentPage?: int32(name='CurrentPage'),
  pageSize?: int32(name='PageSize'),
  sort?: string(name='Sort'),
  dir?: string(name='Dir'),
  dbId?: string(name='DbId'),
  queryString?: string(name='QueryString'),
  payload?: string(name='Payload'),
  loginUser?: string(name='LoginUser'),
  opType?: string(name='OpType'),
  sip?: string(name='Sip'),
  dip?: string(name='Dip'),
  result?: string(name='Result'),
  accessid?: string(name='Accessid'),
  sessionid?: string(name='Sessionid'),
  sqlid?: string(name='Sqlid'),
  dbType?: string(name='DbType'),
  sport?: string(name='Sport'),
  dport?: string(name='Dport'),
  smac?: string(name='Smac'),
  dmac?: string(name='Dmac'),
  dbName?: string(name='DbName'),
  clientPrg?: string(name='ClientPrg'),
  hostName?: string(name='HostName'),
  clientUser?: string(name='ClientUser'),
  sqlLen?: string(name='SqlLen'),
  effectRow?: string(name='EffectRow'),
  cost?: string(name='Cost'),
  resultDesc?: string(name='ResultDesc'),
  dataSet?: string(name='DataSet'),
  alarmName?: string(name='AlarmName'),
  alarmLevel?: string(name='AlarmLevel'),
}

model DescribeAuditLogsResponseBody = {
  totalCount?: int32(name='TotalCount'),
  requestId?: string(name='RequestId'),
  auditLogs?: [ 
    {
      clientUser?: string(name='ClientUser'),
      effectRow?: int32(name='EffectRow'),
      c5?: string(name='C5'),
      clientPrg?: string(name='ClientPrg'),
      accessid?: string(name='Accessid'),
      resultDesc?: string(name='ResultDesc'),
      sqlLen?: int32(name='SqlLen'),
      payload?: string(name='Payload'),
      c4?: string(name='C4'),
      dateTime?: string(name='DateTime'),
      dbName?: string(name='DbName'),
      dataSet?: string(name='DataSet'),
      sqlid?: string(name='Sqlid'),
      relateIp?: string(name='RelateIp'),
      alarmLevel?: int32(name='AlarmLevel'),
      c2?: string(name='C2'),
      dip?: string(name='Dip'),
      result?: int32(name='Result'),
      cost?: int32(name='Cost'),
      relateUser?: string(name='RelateUser'),
      sip?: string(name='Sip'),
      c3?: string(name='C3'),
      hostName?: string(name='HostName'),
      alarmName?: string(name='AlarmName'),
      pickIp?: string(name='PickIp'),
      relateInfo?: string(name='RelateInfo'),
      pickUser?: string(name='PickUser'),
      opType?: string(name='OpType'),
      sport?: int32(name='Sport'),
      dataSetSize?: int32(name='DataSetSize'),
      dbType?: string(name='DbType'),
      alarmFlag?: int32(name='AlarmFlag'),
      smac?: int32(name='Smac'),
      dport?: int32(name='Dport'),
      c1?: string(name='C1'),
      dmac?: int32(name='Dmac'),
      loginUser?: string(name='LoginUser'),
      sessionid?: string(name='Sessionid'),
    }
  ](name='AuditLogs'),
}

model DescribeAuditLogsResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAuditLogsResponseBody(name='body'),
}

async function describeAuditLogsWithOptions(request: DescribeAuditLogsRequest, runtime: Util.RuntimeOptions): DescribeAuditLogsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeAuditLogs', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeAuditLogs(request: DescribeAuditLogsRequest): DescribeAuditLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAuditLogsWithOptions(request, runtime);
}

model DescribeInstanceAttribueRequest {
  lang?: string(name='Lang'),
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
}

model DescribeInstanceAttribueResponseBody = {
  requestId?: string(name='RequestId'),
  instanceAttribue?: {
    vpcId?: string(name='VpcId'),
    vswitchId?: string(name='VswitchId'),
    expireTime?: long(name='ExpireTime'),
    instanceId?: string(name='InstanceId'),
    internetEndpoint?: string(name='InternetEndpoint'),
    regionId?: string(name='RegionId'),
    intranetEndpoint?: string(name='IntranetEndpoint'),
    startTime?: long(name='StartTime'),
    seriesCode?: string(name='SeriesCode'),
    description?: string(name='Description'),
    instanceStatus?: int32(name='InstanceStatus'),
    licenseCode?: string(name='LicenseCode'),
    publicNetworkAccess?: boolean(name='PublicNetworkAccess'),
    whiteList?: [ string ](name='WhiteList'),
  }(name='InstanceAttribue'),
}

model DescribeInstanceAttribueResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeInstanceAttribueResponseBody(name='body'),
}

async function describeInstanceAttribueWithOptions(request: DescribeInstanceAttribueRequest, runtime: Util.RuntimeOptions): DescribeInstanceAttribueResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeInstanceAttribue', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeInstanceAttribue(request: DescribeInstanceAttribueRequest): DescribeInstanceAttribueResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceAttribueWithOptions(request, runtime);
}

model DescribeInstanceAttributeRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
}

model DescribeInstanceAttributeResponseBody = {
  requestId?: string(name='RequestId'),
  instanceAttribute?: {
    vpcId?: string(name='VpcId'),
    vswitchId?: string(name='VswitchId'),
    expireTime?: long(name='ExpireTime'),
    imageVersion?: string(name='ImageVersion'),
    instanceId?: string(name='InstanceId'),
    internetEndpoint?: string(name='InternetEndpoint'),
    regionId?: string(name='RegionId'),
    intranetEndpoint?: string(name='IntranetEndpoint'),
    startTime?: long(name='StartTime'),
    seriesCode?: string(name='SeriesCode'),
    description?: string(name='Description'),
    instanceStatus?: string(name='InstanceStatus'),
    licenseCode?: string(name='LicenseCode'),
    publicNetworkAccess?: boolean(name='PublicNetworkAccess'),
    whiteList?: [ string ](name='WhiteList'),
    ipv6WhiteList?: [ string ](name='Ipv6WhiteList'),
  }(name='InstanceAttribute'),
}

model DescribeInstanceAttributeResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeInstanceAttributeResponseBody(name='body'),
}

async function describeInstanceAttributeWithOptions(request: DescribeInstanceAttributeRequest, runtime: Util.RuntimeOptions): DescribeInstanceAttributeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeInstanceAttribute', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeInstanceAttribute(request: DescribeInstanceAttributeRequest): DescribeInstanceAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceAttributeWithOptions(request, runtime);
}

model DescribeInstancesRequest {
  pageSize?: int32(name='PageSize'),
  currentPage?: int32(name='CurrentPage'),
  regionId?: string(name='RegionId'),
  instanceStatus?: string(name='InstanceStatus'),
  resourceGroupId?: string(name='ResourceGroupId'),
  instanceId?: [ string ](name='InstanceId'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
}

model DescribeInstancesResponseBody = {
  totalCount?: long(name='TotalCount'),
  requestId?: string(name='RequestId'),
  instances?: [ 
    {
      vpcId?: string(name='VpcId'),
      vswitchId?: string(name='VswitchId'),
      expireTime?: long(name='ExpireTime'),
      imageVersion?: string(name='ImageVersion'),
      instanceId?: string(name='InstanceId'),
      internetEndpoint?: string(name='InternetEndpoint'),
      regionId?: string(name='RegionId'),
      intranetEndpoint?: string(name='IntranetEndpoint'),
      startTime?: long(name='StartTime'),
      seriesCode?: string(name='SeriesCode'),
      description?: string(name='Description'),
      instanceStatus?: string(name='InstanceStatus'),
      licenseCode?: string(name='LicenseCode'),
      publicNetworkAccess?: boolean(name='PublicNetworkAccess'),
    }
  ](name='Instances'),
}

model DescribeInstancesResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeInstancesResponseBody(name='body'),
}

async function describeInstancesWithOptions(request: DescribeInstancesRequest, runtime: Util.RuntimeOptions): DescribeInstancesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeInstances', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeInstances(request: DescribeInstancesRequest): DescribeInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstancesWithOptions(request, runtime);
}

model DescribeInstanceStorageRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
}

model DescribeInstanceStorageResponseBody = {
  requestId?: string(name='RequestId'),
  instanceStorages?: [ 
    {
      storageTime?: long(name='StorageTime'),
      storageCapacity?: long(name='StorageCapacity'),
      storageCategory?: string(name='StorageCategory'),
      storageSpace?: string(name='StorageSpace'),
      storageUsed?: long(name='StorageUsed'),
    }
  ](name='InstanceStorages'),
}

model DescribeInstanceStorageResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeInstanceStorageResponseBody(name='body'),
}

async function describeInstanceStorageWithOptions(request: DescribeInstanceStorageRequest, runtime: Util.RuntimeOptions): DescribeInstanceStorageResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeInstanceStorage', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeInstanceStorage(request: DescribeInstanceStorageRequest): DescribeInstanceStorageResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceStorageWithOptions(request, runtime);
}

model DescribeRegionsRequest {
  acceptLanguage?: string(name='AcceptLanguage'),
  regionId?: string(name='RegionId'),
}

model DescribeRegionsResponseBody = {
  requestId?: string(name='RequestId'),
  regions?: [ 
    {
      regionEndpoint?: string(name='RegionEndpoint'),
      localName?: string(name='LocalName'),
      regionId?: string(name='RegionId'),
    }
  ](name='Regions'),
}

model DescribeRegionsResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeRegionsResponseBody(name='body'),
}

async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeRegions', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeRenewStatusRequest {
  regionId?: string(name='RegionId'),
  instanceId?: [ string ](name='InstanceId'),
}

model DescribeRenewStatusResponseBody = {
  requestId?: string(name='RequestId'),
  instances?: [ 
    {
      renewStatus?: string(name='RenewStatus'),
      instanceId?: string(name='InstanceId'),
    }
  ](name='Instances'),
}

model DescribeRenewStatusResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeRenewStatusResponseBody(name='body'),
}

async function describeRenewStatusWithOptions(request: DescribeRenewStatusRequest, runtime: Util.RuntimeOptions): DescribeRenewStatusResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeRenewStatus', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeRenewStatus(request: DescribeRenewStatusRequest): DescribeRenewStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRenewStatusWithOptions(request, runtime);
}

model DescribeSessionLogsRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  startTime?: string(name='StartTime'),
  endTime?: string(name='EndTime'),
  currentPage?: int32(name='CurrentPage'),
  pageSize?: int32(name='PageSize'),
  sort?: string(name='Sort'),
  dir?: string(name='Dir'),
  dbId?: string(name='DbId'),
  sip?: string(name='Sip'),
  sport?: string(name='Sport'),
  loginUser?: string(name='LoginUser'),
  dip?: string(name='Dip'),
  dport?: string(name='Dport'),
  sessionid?: string(name='Sessionid'),
  dbType?: string(name='DbType'),
  smac?: string(name='Smac'),
  dmac?: string(name='Dmac'),
  clientPrg?: string(name='ClientPrg'),
  hostName?: string(name='HostName'),
  clientUser?: string(name='ClientUser'),
  dbName?: string(name='DbName'),
  sessionStatus?: string(name='SessionStatus'),
  sqlCount?: string(name='SqlCount'),
  reqFlow?: string(name='ReqFlow'),
  rspFlow?: string(name='RspFlow'),
}

model DescribeSessionLogsResponseBody = {
  totalCount?: int32(name='TotalCount'),
  requestId?: string(name='RequestId'),
  sessionLogs?: [ 
    {
      clientUser?: string(name='ClientUser'),
      sessionStatus?: int32(name='SessionStatus'),
      c5?: string(name='C5'),
      clientPrg?: string(name='ClientPrg'),
      accessid?: string(name='Accessid'),
      c4?: string(name='C4'),
      dbName?: string(name='DbName'),
      requestFlow?: int32(name='RequestFlow'),
      proCon?: int32(name='ProCon'),
      c2?: string(name='C2'),
      dip?: string(name='Dip'),
      sip?: string(name='Sip'),
      c3?: string(name='C3'),
      hostName?: string(name='HostName'),
      responseFlow?: int32(name='ResponseFlow'),
      encode?: string(name='Encode'),
      normalEnd?: int32(name='NormalEnd'),
      endTime?: int32(name='EndTime'),
      sport?: int32(name='Sport'),
      startTime?: int32(name='StartTime'),
      dbType?: string(name='DbType'),
      strInfo?: string(name='StrInfo'),
      sqlCount?: int32(name='SqlCount'),
      smac?: int32(name='Smac'),
      dport?: int32(name='Dport'),
      dmac?: int32(name='Dmac'),
      c1?: string(name='C1'),
      loginUser?: string(name='LoginUser'),
      sessionid?: string(name='Sessionid'),
    }
  ](name='SessionLogs'),
}

model DescribeSessionLogsResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeSessionLogsResponseBody(name='body'),
}

async function describeSessionLogsWithOptions(request: DescribeSessionLogsRequest, runtime: Util.RuntimeOptions): DescribeSessionLogsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeSessionLogs', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeSessionLogs(request: DescribeSessionLogsRequest): DescribeSessionLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSessionLogsWithOptions(request, runtime);
}

model DisableInstancePublicAccessRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
}

model DisableInstancePublicAccessResponseBody = {
  requestId?: string(name='RequestId'),
}

model DisableInstancePublicAccessResponse = {
  headers: map[string]string(name='headers'),
  body: DisableInstancePublicAccessResponseBody(name='body'),
}

async function disableInstancePublicAccessWithOptions(request: DisableInstancePublicAccessRequest, runtime: Util.RuntimeOptions): DisableInstancePublicAccessResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DisableInstancePublicAccess', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function disableInstancePublicAccess(request: DisableInstancePublicAccessRequest): DisableInstancePublicAccessResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableInstancePublicAccessWithOptions(request, runtime);
}

model EnableInstancePublicAccessRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
}

model EnableInstancePublicAccessResponseBody = {
  requestId?: string(name='RequestId'),
}

model EnableInstancePublicAccessResponse = {
  headers: map[string]string(name='headers'),
  body: EnableInstancePublicAccessResponseBody(name='body'),
}

async function enableInstancePublicAccessWithOptions(request: EnableInstancePublicAccessRequest, runtime: Util.RuntimeOptions): EnableInstancePublicAccessResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('EnableInstancePublicAccess', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function enableInstancePublicAccess(request: EnableInstancePublicAccessRequest): EnableInstancePublicAccessResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableInstancePublicAccessWithOptions(request, runtime);
}

model GenerateUploadAuthRequest {
  regionId?: string(name='RegionId'),
  instanceId?: string(name='InstanceId'),
}

model GenerateUploadAuthResponseBody = {
  requestId?: string(name='RequestId'),
  uploadConfig?: {
    signature?: string(name='Signature'),
    filePath?: string(name='FilePath'),
    policy?: string(name='Policy'),
    expireTime?: long(name='ExpireTime'),
    uploadHost?: string(name='UploadHost'),
    accessId?: string(name='AccessId'),
  }(name='UploadConfig'),
}

model GenerateUploadAuthResponse = {
  headers: map[string]string(name='headers'),
  body: GenerateUploadAuthResponseBody(name='body'),
}

async function generateUploadAuthWithOptions(request: GenerateUploadAuthRequest, runtime: Util.RuntimeOptions): GenerateUploadAuthResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('GenerateUploadAuth', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function generateUploadAuth(request: GenerateUploadAuthRequest): GenerateUploadAuthResponse {
  var runtime = new Util.RuntimeOptions{};
  return generateUploadAuthWithOptions(request, runtime);
}

model GrantServiceRoleRequest {
  regionId?: string(name='RegionId'),
}

model GrantServiceRoleResponseBody = {
  requestId?: string(name='RequestId'),
}

model GrantServiceRoleResponse = {
  headers: map[string]string(name='headers'),
  body: GrantServiceRoleResponseBody(name='body'),
}

async function grantServiceRoleWithOptions(request: GrantServiceRoleRequest, runtime: Util.RuntimeOptions): GrantServiceRoleResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('GrantServiceRole', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function grantServiceRole(request: GrantServiceRoleRequest): GrantServiceRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return grantServiceRoleWithOptions(request, runtime);
}

model ListTagKeysRequest {
  regionId?: string(name='RegionId'),
  resourceType?: string(name='ResourceType'),
  pageSize?: int32(name='PageSize'),
  currentPage?: int32(name='CurrentPage'),
}

model ListTagKeysResponseBody = {
  currentPage?: int32(name='CurrentPage'),
  requestId?: string(name='RequestId'),
  pageSize?: int32(name='PageSize'),
  totalCount?: int32(name='TotalCount'),
  tagKeys?: [ 
    {
      tagCount?: int32(name='TagCount'),
      tagKey?: string(name='TagKey'),
    }
  ](name='TagKeys'),
}

model ListTagKeysResponse = {
  headers: map[string]string(name='headers'),
  body: ListTagKeysResponseBody(name='body'),
}

async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: Util.RuntimeOptions): ListTagKeysResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListTagKeys', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagKeysWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  regionId?: string(name='RegionId'),
  resourceType?: string(name='ResourceType'),
  nextToken?: string(name='NextToken'),
  resourceId?: [ string ](name='ResourceId'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken'),
  requestId?: string(name='RequestId'),
  tagResources?: [ 
    {
      tagValue?: string(name='TagValue'),
      resourceType?: string(name='ResourceType'),
      resourceId?: string(name='ResourceId'),
      tagKey?: string(name='TagKey'),
    }
  ](name='TagResources'),
}

model ListTagResourcesResponse = {
  headers: map[string]string(name='headers'),
  body: ListTagResourcesResponseBody(name='body'),
}

async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ListTagResources', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyInstanceAttributeRequest {
  instanceId?: string(name='InstanceId'),
  description?: string(name='Description'),
  regionId?: string(name='RegionId'),
}

model ModifyInstanceAttributeResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyInstanceAttributeResponse = {
  headers: map[string]string(name='headers'),
  body: ModifyInstanceAttributeResponseBody(name='body'),
}

async function modifyInstanceAttributeWithOptions(request: ModifyInstanceAttributeRequest, runtime: Util.RuntimeOptions): ModifyInstanceAttributeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ModifyInstanceAttribute', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function modifyInstanceAttribute(request: ModifyInstanceAttributeRequest): ModifyInstanceAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyInstanceAttributeWithOptions(request, runtime);
}

model ModifyInstanceStorageRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  storageSpace?: string(name='StorageSpace'),
  storageCategory?: string(name='StorageCategory'),
  storageTime?: int32(name='StorageTime'),
}

model ModifyInstanceStorageResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyInstanceStorageResponse = {
  headers: map[string]string(name='headers'),
  body: ModifyInstanceStorageResponseBody(name='body'),
}

async function modifyInstanceStorageWithOptions(request: ModifyInstanceStorageRequest, runtime: Util.RuntimeOptions): ModifyInstanceStorageResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ModifyInstanceStorage', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function modifyInstanceStorage(request: ModifyInstanceStorageRequest): ModifyInstanceStorageResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyInstanceStorageWithOptions(request, runtime);
}

model MoveResourceGroupRequest {
  resourceId?: string(name='ResourceId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceType?: string(name='ResourceType'),
  regionId?: string(name='RegionId'),
}

model MoveResourceGroupResponseBody = {
  requestId?: string(name='RequestId'),
}

model MoveResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  body: MoveResourceGroupResponseBody(name='body'),
}

async function moveResourceGroupWithOptions(request: MoveResourceGroupRequest, runtime: Util.RuntimeOptions): MoveResourceGroupResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('MoveResourceGroup', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function moveResourceGroup(request: MoveResourceGroupRequest): MoveResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return moveResourceGroupWithOptions(request, runtime);
}

model RefundInstanceRequest {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId'),
  serviceCode?: string(name='ServiceCode'),
}

model RefundInstanceResponseBody = {
  requestId?: string(name='RequestId'),
}

model RefundInstanceResponse = {
  headers: map[string]string(name='headers'),
  body: RefundInstanceResponseBody(name='body'),
}

async function refundInstanceWithOptions(request: RefundInstanceRequest, runtime: Util.RuntimeOptions): RefundInstanceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('RefundInstance', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function refundInstance(request: RefundInstanceRequest): RefundInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return refundInstanceWithOptions(request, runtime);
}

model StartInstanceRequest {
  instanceId?: string(name='InstanceId'),
  vswitchId?: string(name='VswitchId'),
  regionId?: string(name='RegionId'),
}

model StartInstanceResponseBody = {
  requestId?: string(name='RequestId'),
}

model StartInstanceResponse = {
  headers: map[string]string(name='headers'),
  body: StartInstanceResponseBody(name='body'),
}

async function startInstanceWithOptions(request: StartInstanceRequest, runtime: Util.RuntimeOptions): StartInstanceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('StartInstance', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function startInstance(request: StartInstanceRequest): StartInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startInstanceWithOptions(request, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='RegionId'),
  resourceType?: string(name='ResourceType'),
  resourceId?: [ string ](name='ResourceId'),
  tag?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tag'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId'),
}

model TagResourcesResponse = {
  headers: map[string]string(name='headers'),
  body: TagResourcesResponseBody(name='body'),
}

async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('TagResources', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  regionId?: string(name='RegionId'),
  resourceType?: string(name='ResourceType'),
  all?: boolean(name='All'),
  resourceId?: [ string ](name='ResourceId'),
  tagKey?: [ string ](name='TagKey'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId'),
}

model UntagResourcesResponse = {
  headers: map[string]string(name='headers'),
  body: UntagResourcesResponseBody(name='body'),
}

async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('UntagResources', '2018-10-29', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

