AnyCall‐Alibaba Availability APIs Guide - cloud-barista/cb-spider GitHub Wiki

[AnyCall:Alibaba] Instance Type and Disk Availability API Guide

  * Alibaba는 `Zone`에서 활용 가능한 `Instance Type`이 가변적이다. 
  * `Instance Type`에 따라 선택 가능한 `System Disk Type`이 다르다.
  * 이에 Alibaba에 특화된 `Instance Type` 가용 정보를 제공하는 AnyCall API를 제공한다. 
  * AnyCall은 CSP 특화 제공 API이므로, 용어 등도 추상화 하지 않고 가급적 CSP를 따른다.

[CheckInstanceTypeAvailability API]

  • 현재 Connection의 Region/Zone에서 InstanceType 가용성 제공
  • 가능한 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d \
'{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "CheckInstanceTypeAvailability",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.c7.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "CheckInstanceTypeAvailability",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.c7.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}
  • 가능하지 않은 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d \
'{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "CheckInstanceTypeAvailability",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.g6.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "CheckInstanceTypeAvailability",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.g6.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "Result",
         "Value" : "false"
      },
      {
         "Key" : "Reason",
         "Value" : "InstanceType not available"
      }
   ]
}

[GetInstanceTypeAvailableZones API]

  • 현재 Connection의 Region에서 InstanceType 가용한 Zone 목록 제공
  • 가용한 Zone이 존재하는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "GetInstanceTypeAvailableZones",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.c7.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "GetInstanceTypeAvailableZones",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.c7.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableZones",
         "Value" : "cn-beijing-f,cn-beijing-i,cn-beijing-l,cn-beijing-k"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}
  • 가용한 Zone이 없는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "GetInstanceTypeAvailableZones",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.g6.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "GetInstanceTypeAvailableZones",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.g6.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableZones",
         "Value" : "none"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}

[GetInstanceTypeAvailableAllZones API]

  • 현재 InstanceType이 가용한 모든 Region 및 Zone 목록 제공
  • 예시-1
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
	"ConnectionName": "alibaba-beijing-config",
	"ReqInfo": {
		"FID": "GetInstanceTypeAvailableAllZones",
		"IKeyValueList": [
			{"Key": "InstanceType", "Value": "ecs.c7.large"}
		]
	}
}' | json_pp

=>

{
   "FID" : "GetInstanceTypeAvailableAllZones",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.c7.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableAllZones",
         "Value" : "cn-beijing:cn-beijing-f,cn-beijing:cn-beijing-i,cn-beijing:cn-beijing-l,cn-beijing:cn-beijing-k,cn-wulanchabu:cn-wulanchabu-b,cn-wulanchabu:cn-wulanchabu-a,cn-wulanchabu:cn-wulanchabu-c,cn-hangzhou:cn-hangzhou-b,cn-hangzhou:cn-hangzhou-j,cn-hangzhou:cn-hangzhou-k,cn-shanghai:cn-shanghai-l,cn-shanghai:cn-shanghai-n,cn-shanghai:cn-shanghai-e,cn-shenzhen:cn-shenzhen-f,cn-shenzhen:cn-shenzhen-d,cn-shenzhen:cn-shenzhen-c,cn-heyuan:cn-heyuan-b,cn-heyuan:cn-heyuan-a,cn-guangzhou:cn-guangzhou-a,cn-guangzhou:cn-guangzhou-b,cn-fuzhou:cn-fuzhou-a,cn-chengdu:cn-chengdu-a,cn-chengdu:cn-chengdu-b,cn-hongkong:cn-hongkong-d,cn-hongkong:cn-hongkong-c,cn-hongkong:cn-hongkong-b,ap-northeast-1:ap-northeast-1b,ap-northeast-1:ap-northeast-1c,ap-northeast-1:ap-northeast-1a,ap-northeast-2:ap-northeast-2a,ap-southeast-1:ap-southeast-1a,ap-southeast-1:ap-southeast-1b,ap-southeast-1:ap-southeast-1c,ap-southeast-3:ap-southeast-3b,ap-southeast-3:ap-southeast-3a,ap-southeast-5:ap-southeast-5a,ap-southeast-5:ap-southeast-5c,ap-southeast-5:ap-southeast-5b,ap-southeast-7:ap-southeast-7a,us-east-1:us-east-1a,us-east-1:us-east-1b,eu-central-1:eu-central-1c,eu-central-1:eu-central-1a"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}
  • 예시-2
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
	"ConnectionName": "alibaba-beijing-config",
	"ReqInfo": {
		"FID": "GetInstanceTypeAvailableAllZones",
		"IKeyValueList": [
			{"Key": "InstanceType", "Value": "ecs.g6.large"}
		]
	}
}' | json_pp

=>

{
   "FID" : "GetInstanceTypeAvailableAllZones",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.g6.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableAllZones",
         "Value" : "cn-huhehaote:cn-huhehaote-a,cn-wulanchabu:cn-wulanchabu-a,cn-guangzhou:cn-guangzhou-a,cn-chengdu:cn-chengdu-a,ap-northeast-1:ap-northeast-1a,ap-northeast-2:ap-northeast-2a,us-east-1:us-east-1a,eu-west-1:eu-west-1a,eu-central-1:eu-central-1a"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}

[GetAvailableSystemDisksByInstanceType API]

  • 현재 Connection의 Region/Zone에서 InstanceType이 사용 가능한 SystemDisk Type 목록 제공
  • 가용한 InstanceType이 존재하는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "GetAvailableSystemDisksByInstanceType",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.c7.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "GetAvailableSystemDisksByInstanceType",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.c7.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "Result",
         "Value" : "true"
      },
      {
         "Key" : "AvailableSystemDisks",
         "Value" : "cloud_auto,cloud_essd"
      }
   ]
}
  • 가용한 InstanceType이 존재하지 않는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
    "ConnectionName": "alibaba-beijing-config",
    "ReqInfo": {
        "FID": "GetAvailableSystemDisksByInstanceType",
        "IKeyValueList": [
            {"Key": "InstanceType", "Value": "ecs.g6.large"}
        ]
    }
}' | json_pp

=>

{
   "FID" : "GetAvailableSystemDisksByInstanceType",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.g6.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "Result",
         "Value" : "true"
      },
      {
         "Key" : "AvailableSystemDisks",
         "Value" : "none"
      }
   ]
}

[GetAvailableDataDisksByInstanceType API]

  • 현재 Connection의 Region/Zone에서 InstanceType이 사용 가능한 DataDisk Type 목록 제공
  • 가용한 InstanceType이 존재하는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
	"ConnectionName": "alibaba-beijing-config",
	"ReqInfo": {
		"FID": "GetAvailableDataDisksByInstanceType",
		"IKeyValueList": [
			{"Key": "InstanceType", "Value": "ecs.c7.large"}
		]
	}
}' | json_pp

=>

{
   "FID" : "GetAvailableDataDisksByInstanceType",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.c7.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableDataDisks",
         "Value" : "cloud_auto,cloud_essd"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}
  • 가용한 InstanceType이 존재하지 않는 경우 예시
curl -sX POST http://localhost:1024/spider/anycall -H 'Content-Type: application/json' -d '
{
	"ConnectionName": "alibaba-beijing-config",
	"ReqInfo": {
		"FID": "GetAvailableDataDisksByInstanceType",
		"IKeyValueList": [
			{"Key": "InstanceType", "Value": "ecs.g6.large"}
		]
	}
}' | json_pp

=>

{
   "FID" : "GetAvailableDataDisksByInstanceType",
   "IKeyValueList" : [
      {
         "Key" : "InstanceType",
         "Value" : "ecs.g6.large"
      }
   ],
   "OKeyValueList" : [
      {
         "Key" : "AvailableDataDisks",
         "Value" : "none"
      },
      {
         "Key" : "Result",
         "Value" : "true"
      }
   ]
}