Skip to content

How to get CSP resources Info with CSP ID

ByoungSeob Kim edited this page Nov 21, 2022 · 3 revisions
  • CSP ID(SystemID)를 이용하여 Resource 정보를 검색하는 개발자용 REST API

    • NameId를 사용하지 않으므로, Driver에 따라서 NameId가 "" 일수 있음
  • 규격(예시)

    curl -sX GET http://localhost:1024/spider/cspresourceinfo/vpc-029fea87843650401 -H 'Content-Type: application/json' -d \
          '{
              "ConnectionName": "aws-ohio-config",
              "ResourceType": "vpc"
          }' | json_pp
    
    • 사용 가능한 ResourceType:
      vpc
      sg
      keypair
      vm
      nlb
      disk
      myimage
      cluster
      
  • 이하 자원별 활용 예시


  • VPC
curl -sX GET http://localhost:1024/spider/cspresourceinfo/vpc-029fea87843650401 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "vpc"
	    }' | json_pp

=>

{
   "IId" : {
      "NameId" : "vpc-01-cdth54ncl16ae4d9du9g",
      "SystemId" : "vpc-029fea87843650401"
   },
   "IPv4_CIDR" : "10.0.0.0/16",
   "KeyValueList" : null,
   "SubnetInfoList" : [
      {
         "IId" : {
            "NameId" : "",
            "SystemId" : "subnet-0e3f6172717f941de"
         },
         "IPv4_CIDR" : "10.0.8.0/22",
         "KeyValueList" : [
            {
               "Key" : "VpcId",
               "Value" : "vpc-029fea87843650401"
            },
            {
               "Key" : "MapPublicIpOnLaunch",
               "Value" : "false"
            },
            {
               "Key" : "AvailableIpAddressCount",
               "Value" : "1019"
            },
            {
               "Key" : "AvailabilityZone",
               "Value" : "us-east-2a"
            },
            {
               "Key" : "Status",
               "Value" : "available"
            }
         ]
      }
   ]
}

  • Security Group
curl -sX GET http://localhost:1024/spider/cspresourceinfo/sg-0879758886243eaa3 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "sg"
	    }' | json_pp

=>

{
   "IId" : {
      "NameId" : "sg01-cdth56fcl16ae4d9duag",
      "SystemId" : "sg-0879758886243eaa3"
   },
   "KeyValueList" : [
      {
         "Key" : "GroupName",
         "Value" : "sg01-cdth56fcl16ae4d9duag"
      },
      {
         "Key" : "VpcID",
         "Value" : "vpc-029fea87843650401"
      },
      {
         "Key" : "OwnerID",
         "Value" : "635484366616"
      },
      {
         "Key" : "Description",
         "Value" : "sg01-cdth56fcl16ae4d9duag"
      }
   ],
   "SecurityRules" : [
      {
         "CIDR" : "0.0.0.0/0",
         "Direction" : "inbound",
         "FromPort" : "1",
         "IPProtocol" : "tcp",
         "ToPort" : "65535"
      },
      {
         "CIDR" : "0.0.0.0/0",
         "Direction" : "outbound",
         "FromPort" : "-1",
         "IPProtocol" : "ALL",
         "ToPort" : "-1"
      }
   ],
   "VpcIID" : {
      "NameId" : "",
      "SystemId" : "vpc-029fea87843650401"
   }
}

  • KeyPair
curl -sX GET http://localhost:1024/spider/cspresourceinfo/keypair-01-cdth57ncl16ae4d9dub0 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "keypair"
	    }' | json_pp

=>

{
   "Fingerprint" : "92:86:9e:0a:b1:53:50:95:8e:ed:74:45:66:d2:17:a4:c0:c2:13:e6",
   "IId" : {
      "NameId" : "keypair-01-cdth57ncl16ae4d9dub0",
      "SystemId" : "keypair-01-cdth57ncl16ae4d9dub0"
   },
   "KeyValueList" : [],
   "PrivateKey" : "",
   "PublicKey" : "",
   "VMUserID" : ""
}

  • VM
curl -sX GET http://localhost:1024/spider/cspresourceinfo/i-0e39385e679c1baee -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "vm"
	    }' | json_pp

=>

{
   "DataDiskIIDs" : [],
   "IId" : {
      "NameId" : "vm-01-cdth59fcl16ae4d9dubg",
      "SystemId" : "i-0af7abc7fe76b999e"
   },
   "ImageIId" : {
      "NameId" : "ami-00978328f54e31526",
      "SystemId" : "ami-00978328f54e31526"
   },
   "ImageType" : "",
   "KeyPairIId" : {
      "NameId" : "keypair-01-cdth57ncl16ae4d9dub0",
      "SystemId" : "keypair-01-cdth57ncl16ae4d9dub0"
   },
   "KeyValueList" : [
      {
         "Key" : "State",
         "Value" : "running"
      },
      {
         "Key" : "Architecture",
         "Value" : "x86_64"
      },
      {
         "Key" : "VpcId",
         "Value" : "vpc-029fea87843650401"
      },
      {
         "Key" : "SubnetId",
         "Value" : "subnet-0e3f6172717f941de"
      },
      {
         "Key" : "KeyName",
         "Value" : "keypair-01-cdth57ncl16ae4d9dub0"
      },
      {
         "Key" : "VirtualizationType",
         "Value" : "hvm"
      }
   ],
   "NetworkInterface" : "eni-attach-07044290337f1fff0",
   "PrivateDNS" : "ip-10-0-11-147.us-east-2.compute.internal",
   "PrivateIP" : "10.0.11.147",
   "PublicDNS" : "",
   "PublicIP" : "3.140.188.231",
   "Region" : {
      "Region" : "us-east-2",
      "Zone" : "us-east-2a"
   },
   "RootDeviceName" : "/dev/sda1",
   "RootDiskSize" : "8",
   "RootDiskType" : "gp2",
   "SSHAccessPoint" : "",
   "SecurityGroupIIds" : [
      {
         "NameId" : "sg01-cdth56fcl16ae4d9duag",
         "SystemId" : "sg-0879758886243eaa3"
      }
   ],
   "StartTime" : "2022-11-21T05:54:33Z",
   "SubnetIID" : {
      "NameId" : "",
      "SystemId" : "subnet-0e3f6172717f941de"
   },
   "VMBlockDisk" : "/dev/sda1",
   "VMBootDisk" : "",
   "VMSpecName" : "t2.micro",
   "VMUserId" : "",
   "VMUserPasswd" : "",
   "VpcIID" : {
      "NameId" : "",
      "SystemId" : "vpc-029fea87843650401"
   }
}

  • NLB(Network Load Balancer)
curl -sX GET http://localhost:1024/spider/cspresourceinfo/arn:aws:elasticloadbalancing:us-east-2:635484366616:loadbalancer/net/spider-nlb--cdth98fcl16ae4d9dud0/16084cef9d03e799 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "nlb"
	    }' | json_pp

=>

{
   "CreatedTime" : "2022-11-21T06:03:01.624Z",
   "HealthChecker" : {
      "CspID" : "arn:aws:elasticloadbalancing:us-east-2:635484366616:targetgroup/spider-nlb--cdth98fcl16ae4d9dud0/cfb88e14fd03351d",
      "Interval" : 10,
      "KeyValueList" : null,
      "Port" : "22",
      "Protocol" : "TCP",
      "Threshold" : 3,
      "Timeout" : 10
   },
   "IId" : {
      "NameId" : "spider-nlb--cdth98fcl16ae4d9dud0",
      "SystemId" : "arn:aws:elasticloadbalancing:us-east-2:635484366616:loadbalancer/net/spider-nlb--cdth98fcl16ae4d9dud0/16084cef9d03e799"
   },
   "KeyValueList" : [
      {
         "Key" : "Scheme",
         "Value" : "internet-facing"
      },
      ... 중략 ...

   ],
   "Listener" : {
      "CspID" : "arn:aws:elasticloadbalancing:us-east-2:635484366616:listener/net/spider-nlb--cdth98fcl16ae4d9dud0/16084cef9d03e799/f85a4977c1eeb283",
      "DNSName" : "spider-nlb--cdth98fcl16ae4d9dud0-16084cef9d03e799.elb.us-east-2.amazonaws.com",
      "IP" : "",
      "KeyValueList" : [
         {
            "Key" : "ListenerArn",
            "Value" : "arn:aws:elasticloadbalancing:us-east-2:635484366616:listener/net/spider-nlb--cdth98fcl16ae4d9dud0/16084cef9d03e799/f85a4977c1eeb283"
         },
         ... 중략 ...

      ],
      "Port" : "22",
      "Protocol" : "TCP"
   },
   "Scope" : "REGION",
   "Type" : "PUBLIC",
   "VMGroup" : {
      "CspID" : "arn:aws:elasticloadbalancing:us-east-2:635484366616:targetgroup/spider-nlb--cdth98fcl16ae4d9dud0/cfb88e14fd03351d",
      "KeyValueList" : [
         {
            "Key" : "LoadBalancerArns",
            "Value" : "[arn:aws:elasticloadbalancing:us-east-2:635484366616:loadbalancer/net/spider-nlb--cdth98fcl16ae4d9dud0/16084cef9d03e799]"
         },

         ... 중략 ...
 
      ],
      "Port" : "22",
      "Protocol" : "TCP",
      "VMs" : [
         {
            "NameId" : "",
            "SystemId" : "i-025262a7844f685cc"
         },
         {
            "NameId" : "",
            "SystemId" : "i-0af7abc7fe76b999e"
         }
      ]
   },
   "VpcIID" : {
      "NameId" : "",
      "SystemId" : "vpc-029fea87843650401"
   }
}

  • Disk(Volume)
curl -sX GET http://localhost:1024/spider/cspresourceinfo/vol-08777c1ad09352967 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "disk"
	    }' | json_pp

=>

{
   "CreatedTime" : "2022-11-21T05:59:57.404Z",
   "DiskSize" : "1",
   "DiskType" : "standard",
   "IId" : {
      "NameId" : "spider-disk-01-cdth7qncl16ae4d9duc0",
      "SystemId" : "vol-08777c1ad09352967"
   },
   "KeyValueList" : [
      {
         "Key" : "Encrypted",
         "Value" : "false"
      },
      {
         "Key" : "MultiAttachEnabled",
         "Value" : "false"
      }
   ],
   "OwnerVM" : {
      "NameId" : "",
      "SystemId" : ""
   },
   "Status" : "Available"
}

  • MyImage(Custom Image)
curl -sX GET http://localhost:1024/spider/cspresourceinfo/ami-01dc0aeb7fe621bdf -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "aws-ohio-config",
	        "ResourceType": "myimage"
	    }' | json_pp

=>

{
   "CreatedTime" : "2022-11-21T06:06:23Z",
   "IId" : {
      "NameId" : "",
      "SystemId" : "ami-01dc0aeb7fe621bdf"
   },
   "KeyValueList" : null,
   "SourceVM" : {
      "NameId" : "",
      "SystemId" : "i-0af7abc7fe76b999e"
   },
   "Status" : "Unavailable"
}

  • PMKS(Provider Managed K8S)
curl -sX GET http://localhost:1024/spider/cspresourceinfo/cls-eq3cy4a1 -H 'Content-Type: application/json' -d \
        '{
	        "ConnectionName": "tencent-seoul1-config",
	        "ResourceType": "cluster"
	    }' | json_pp

=>

{
   "AccessInfo" : {
      "Endpoint" : "Cluster is not ready yet!",
      "Kubeconfig" : "Kubeconfig is not ready yet!"
   },
   "Addons" : {
      "KeyValueList" : null
   },
   "CreatedTime" : "2022-11-21T08:04:49Z",
   "IId" : {
      "NameId" : "spider_cluster_01_cdtj2ancl16b7ve7qdv0",
      "SystemId" : "cls-eq3cy4a1"
   },
   "KeyValueList" : [
      {
         "Key" : "ClusterNetworkSettings.MaxNodePodNum",
         "Value" : "256"
      },
      {
         "Key" : "CreatedTime",
         "Value" : "2022-11-21T08:04:49Z"
      },
      ... 중략 ...

   ],
   "Network" : {
      "KeyValueList" : null,
      "SecurityGroupIIDs" : [
         {
            "NameId" : "",
            "SystemId" : "sg-2z7dr73l"
         }
      ],
      "SubnetIIDs" : [
         {
            "NameId" : "",
            "SystemId" : "subnet-4wop7ohd"
         }
      ],
      "VpcIID" : {
         "NameId" : "",
         "SystemId" : "vpc-mg7lrpom"
      }
   },
   "NodeGroupList" : null,
   "Status" : "Creating",
   "Version" : "1.22.5"
}

Table of contents



Clone this wiki locally