REST API Region Zone Information Guide - cloud-barista/cb-spider GitHub Wiki

[REST API 기반 Region/Zone 정보 활용 방법]


1. 연결 설정 이전에 활용 가능한 API

  • 연결 설정 전에 Driver Name과 Credential Name으로 Region/Zone 정보를 얻는 API
    • ※ 연결 설정(Connection Config): DriverName + CredentialName + RegionName으로 구성된 연결 이름(Connection ID)
  • (준비) 등록된 클라우드 드라이버 및 크리덴셜 정보 확인(DriverName, CredentialName 얻기)

    curl -sX GET http://localhost:1024/spider/driver |json_pp;
    
    curl -sX GET http://localhost:1024/spider/credential |json_pp;
    

(1) REST API 기반 Region/Zone 정보 활용 방법

  • AWS 전체 Region/Zone 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
    
  • output:

    {
       "regionzone" : [
          {
             "DisplayName" : "ap-northeast-2",
             "KeyValueList" : [],
             "Name" : "ap-northeast-2",
             "ZoneList" : [
                {
                   "DisplayName" : "ap-northeast-2a",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2a",
                   "Status" : "Available"
                },
                {
                   "DisplayName" : "ap-northeast-2b",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2b",
                   "Status" : "Available"
                },
                {
                   "DisplayName" : "ap-northeast-2c",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2c",
                   "Status" : "Available"
                },
    --More--
    
  • (2) AWS 특정 Region의 Region/Zone 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/ap-northeast-2?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
    
  • output:

    {
       "DisplayName" : "ap-northeast-2",
       "KeyValueList" : [],
       "Name" : "ap-northeast-2",
       "ZoneList" : [
          {
             "DisplayName" : "ap-northeast-2a",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2a",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2b",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2b",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2c",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2c",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2d",
             "KeyValueList" : null,
    --More--
    
  • (3) AWS 전체 Region 원본 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
    
  • output:

    {
       "Regions" : [
          {
             "Endpoint" : "ec2.ap-south-2.amazonaws.com",
             "OptInStatus" : "not-opted-in",
             "RegionName" : "ap-south-2"
          },
          {
             "Endpoint" : "ec2.ap-south-1.amazonaws.com",
             "OptInStatus" : "opt-in-not-required",
             "RegionName" : "ap-south-1"
          },
          {
             "Endpoint" : "ec2.eu-south-1.amazonaws.com",
             "OptInStatus" : "opted-in",
             "RegionName" : "eu-south-1"
          },
          {
             "Endpoint" : "ec2.eu-south-2.amazonaws.com",
             "OptInStatus" : "not-opted-in",
             "RegionName" : "eu-south-2"
          },
          {
             "Endpoint" : "ec2.me-central-1.amazonaws.com",
             "OptInStatus" : "opted-in",
             "RegionName" : "me-central-1"
    --More--
    

2. 연결 설정 이후 활용 가능한 API

  • 연결 설정 이름(ConnectionName)으로 Region/Zeon 정보를 얻는 API

(준비) 등록된 클라우드 연결 설정 정보 확인(ConnectionName 얻기)

curl -sX GET http://localhost:1024/spider/connectionconfig |json_pp;

(1) REST API 기반 Region/Zone 정보 활용 방법

  • AWS 전체 Region/Zone 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=aws-config01" | json_pp
    
  • output:

    {
       "regionzone" : [
          {
             "DisplayName" : "ap-northeast-2",
             "KeyValueList" : [],
             "Name" : "ap-northeast-2",
             "ZoneList" : [
                {
                   "DisplayName" : "ap-northeast-2a",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2a",
                   "Status" : "Available"
                },
                {
                   "DisplayName" : "ap-northeast-2b",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2b",
                   "Status" : "Available"
                },
                {
                   "DisplayName" : "ap-northeast-2c",
                   "KeyValueList" : null,
                   "Name" : "ap-northeast-2c",
                   "Status" : "Available"
                },
                {
    --More--
    
  • (2) AWS 특정 Region의 Region/Zone 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/regionzone/ap-northeast-2?ConnectionName=aws-config01" | json_pp
    
  • output:

    {
       "DisplayName" : "ap-northeast-2",
       "KeyValueList" : [],
       "Name" : "ap-northeast-2",
       "ZoneList" : [
          {
             "DisplayName" : "ap-northeast-2a",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2a",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2b",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2b",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2c",
             "KeyValueList" : null,
             "Name" : "ap-northeast-2c",
             "Status" : "Available"
          },
          {
             "DisplayName" : "ap-northeast-2d",
             "KeyValueList" : null,
    --More--
    
  • (3) AWS 전체 Region 원본 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=aws-config01" | json_pp
    
  • output:

    {
       "Regions" : [
          {
             "Endpoint" : "ec2.ap-south-2.amazonaws.com",
             "OptInStatus" : "not-opted-in",
             "RegionName" : "ap-south-2"
          },
          {
             "Endpoint" : "ec2.ap-south-1.amazonaws.com",
             "OptInStatus" : "opt-in-not-required",
             "RegionName" : "ap-south-1"
          },
          {
             "Endpoint" : "ec2.eu-south-1.amazonaws.com",
             "OptInStatus" : "opted-in",
             "RegionName" : "eu-south-1"
          },
          {
             "Endpoint" : "ec2.eu-south-2.amazonaws.com",
             "OptInStatus" : "not-opted-in",
             "RegionName" : "eu-south-2"
          },
          {
             "Endpoint" : "ec2.me-central-1.amazonaws.com",
             "OptInStatus" : "opted-in",
             "RegionName" : "me-central-1"
    --More--
    
  • (4) AWS 전체 Zone 원본 정보 얻는 방법

    curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=aws-config01" | json_pp
    
  • output:

    [
       {
          "AvailabilityZones" : [
             {
                "GroupName" : "ap-south-1",
                "Messages" : null,
                "NetworkBorderGroup" : "ap-south-1",
                "OptInStatus" : "opt-in-not-required",
                "ParentZoneId" : null,
                "ParentZoneName" : null,
                "RegionName" : "ap-south-1",
                "State" : "available",
                "ZoneId" : "aps1-az1",
                "ZoneName" : "ap-south-1a",
                "ZoneType" : "availability-zone"
             },
             {
                "GroupName" : "ap-south-1",
                "Messages" : null,
                "NetworkBorderGroup" : "ap-south-1",
                "OptInStatus" : "opt-in-not-required",
                "ParentZoneId" : null,
                "ParentZoneName" : null,
                "RegionName" : "ap-south-1",
                "State" : "available",
                "ZoneId" : "aps1-az3",
    --More--
    

[특이 사항 및 Advance 설정 가이드]

[RegionZone API 활용 예시 및 시험 결과]

  • 시험 결과 (2024.03.13 현재)

    • KTVPC:시험전
    • 그외 CSP 성공
  • CSP별 활용 예시

[Mock]

  • 연결 설정 이전
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=mock-driver-01&CredentialName=mock-credential-01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/neptune?DriverName=mock-driver-01&CredentialName=mock-credential-01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=mock-driver-01&CredentialName=mock-credential-01" | json_pp
  • 연결 설정 이후
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=mock-config-01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/neptune?ConnectionName=mock-config-01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=mock-config-01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=mock-config-01" | json_pp

[AWS] (cloudos_meta.yaml: default Region/Zone 사용)

  • 연결 설정 이전
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/ap-northeast-2?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=aws-driver01&CredentialName=aws-credential01" | json_pp
  • 연결 설정 이후
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=aws-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/ap-northeast-2?ConnectionName=aws-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=aws-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=aws-config01" | json_pp

[Azure]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=azure-driver01&CredentialName=azure-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/australiacentral?DriverName=azure-driver01&CredentialName=azure-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=azure-driver01&CredentialName=azure-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=azure-northeu-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/australiacentral?ConnectionName=azure-northeu-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=azure-northeu-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=azure-northeu-config" | json_pp

[GCP]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=gcp-driver01&CredentialName=gcp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/me-central1?DriverName=gcp-driver01&CredentialName=gcp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=gcp-driver01&CredentialName=gcp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=gcp-iowa-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/me-central1?ConnectionName=gcp-iowa-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=gcp-iowa-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=gcp-iowa-config" | json_pp

[Alibaba] (cloudos_meta.yaml: default Region/Zone 사용)

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=alibaba-driver01&CredentialName=alibaba-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/cn-hangzhou?DriverName=alibaba-driver01&CredentialName=alibaba-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=alibaba-driver01&CredentialName=alibaba-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=alibaba-beijing-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/cn-hangzhou?ConnectionName=alibaba-beijing-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=alibaba-beijing-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=alibaba-beijing-config" | json_pp

[Tencent] (cloudos_meta.yaml: default Region/Zone 사용)

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=tencent-driver01&CredentialName=tencent-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/sa-saopaulo?DriverName=tencent-driver01&CredentialName=tencent-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=tencent-driver01&CredentialName=tencent-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=tencent-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/sa-saopaulo?ConnectionName=tencent-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=tencent-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=tencent-seoul1-config" | json_pp

[OpenStack]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=openstack-driver01&CredentialName=openstack-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/RegionOne?DriverName=openstack-driver01&CredentialName=openstack-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=openstack-driver01&CredentialName=openstack-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=openstack-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/RegionOne?ConnectionName=openstack-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=openstack-config01" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=openstack-config01" | json_pp

[NCP]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=ncp-driver01&CredentialName=ncp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/USWN?DriverName=ncp-driver01&CredentialName=ncp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=ncp-driver01&CredentialName=ncp-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=ncp-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/USWN?ConnectionName=ncp-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=ncp-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=ncp-korea1-config" | json_pp

[NCPVPC]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=ncpvpc-driver01&CredentialName=ncpvpc-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/SGN?DriverName=ncpvpc-driver01&CredentialName=ncpvpc-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=ncpvpc-driver01&CredentialName=ncpvpc-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=ncpvpc-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/SGN?ConnectionName=ncpvpc-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=ncpvpc-korea1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=ncpvpc-korea1-config" | json_pp

[HNH]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=nhncloud-driver01&CredentialName=nhncloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/JP1?DriverName=nhncloud-driver01&CredentialName=nhncloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=nhncloud-driver01&CredentialName=nhncloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=nhncloud-korea-pangyo-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/JP1?ConnectionName=nhncloud-korea-pangyo-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=nhncloud-korea-pangyo-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=nhncloud-korea-pangyo-config" | json_pp

[KT]

curl -sX GET "http://localhost:1024/spider/preconfig/regionzone?DriverName=ktcloud-driver01&CredentialName=ktcloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/regionzone/KOR-Seoul?DriverName=ktcloud-driver01&CredentialName=ktcloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/preconfig/orgregion?DriverName=ktcloud-driver01&CredentialName=ktcloud-credential01" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone?ConnectionName=ktcloud-korea-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/regionzone/KOR-Seoul?ConnectionName=ktcloud-korea-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgregion?ConnectionName=ktcloud-korea-seoul1-config" | json_pp
curl -sX GET "http://localhost:1024/spider/orgzone?ConnectionName=ktcloud-korea-seoul1-config" | json_pp

[KTVPC]

  • 시험 제외: KTVPC Driver Repos의 Spider Repos 통합 진행중