46
1 Directions for API 游游游 [email protected]

1 Directions for API 游志誠 [email protected]. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

Embed Size (px)

Citation preview

Page 1: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

1

Directions for API

游志誠[email protected]

Page 2: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

2

Steps for Trials (Users)(1/5)

How to begin?

To go to CloudBOSS UP to apply for a set of API trial keys.To go to UP to apply for the only set of access key and secret key for the user.

To browze the methods of calculation signature or download the Java SDK of calculation signature in API developer’s platform.To browse how to calculate URI parameter signature in the API directions documents. The Java developers can also download SDK (software development kits) with calculation methods.

directions document on the API developer’s platform and understand how to send a request for REST.directions document, including request parameter, response parameter, and examples. There are also detailed directions for how to send a request for REST.

To begin using APITo send out REST request to call for API services such as Hicloud CaaS. For API REST service, please go to hws.hicloud.hinet.net

Page 3: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

3

Steps for Trials (Users) (2/5)API Developer’s Platform: http://hws.hicloud.hinet.net/hws-doc/API Directions Documents

To browse API service directions.

Directions for API service parameter.

Page 4: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

4

Steps for Trials (Users) (3/5)Cloud BOSS UP Trial Environment of Cloud BOSS UP: https://hwsup.hicloud.hinet.net/cloud/To apply for or inquiry for API trial keys.

Click the link of API data in UP, the trial keys can be applied or inquired.

After clicking, the contents of secret key can be examined.

To record the two keys so as to make calculation signature and send out REST request.

Page 5: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

5

Steps for Trials (Users) (4/5)API Developer’s Platform : http://hws.hicloud.hinet.net/hws-doc/The method of signature calculation.

There is a method of signature calculation in the link of “the method of calling for REST” in the API directions documents in hicloud web services which can be browsed without logging in

Click the link of downloading, and the method of signature calculation can be downloaded.

Page 6: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

6

Steps for Trials (Users) (5/5)

Finally, you can begin using API to develop your application.

Please use hicloud Web Services directions which include common parameter directions and wrong codes, and the development of your application program can be speeded up.

To send out REST request

API with signatures.

To develop or use Http Client program which can send out

REST request.

To use secret key to

calculate signature strings.

Page 7: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

7

API orders to be used.

Classification

API Name Description

VM

runInstancesTo build a VM (Clone From Template or VM Service ID can be assigned.)

terminateInstances To delete VM.rebootInstances To reboot VM.startInstances To initiate VM.stopInstances To stop VM.describeInstances To inquiry for VM list.

modifyInstanceAttributeTo upgrade or degrade VM (including the change in CPU or RAM or Cloud Watch).

CloudWatch getInstancesStatsTo acquire the latest data in VM monitoring.

LoadBalancer

describeLoadBalancerPolicies

To inquire for the list of load balancer policies.

createLoadBalancerPolicy To create load balancer policies.replaceLoadBalancerPolicy To change load balancer policies.deleteLoadBalancerPolicy To delete load balancer policies.

Page 8: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

8

Calling API by REST Client

ToolsFirefox with RESTClient plug-in (or other

REST Client)JsonView

Page 9: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

9

Get Access KeyCloud BOSS UP Trial Environment for Cloud BOSS UP: https://hwsup.hicloud.hinet.net/cloud/Application or inquiry for API trial keys

Click the link of API data in UP, and you can apply or inquire for keys.

The contents of the secret key can be examined after the button is clicked.

To record both of the keys so as to calculate signature and send out REST request.

Page 10: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

10

Calculating Signature(1/2)

For details, please see http://hws.hicloud.hinet.net/hws-doc/rest/tutorial/howto-gen-signature.htmlThis course uses REST service production (for this course only)Website to call for the service:

http://hws.hicloud.hinet.net/cloud_hws/api/hwsDemo/generateApiKeySignature?chtAuthType=demopass&hnNo=${hnNo} (hnNo would be acquired from ID.)

Enter the order in body (do not enter expires).

Use POST.

Page 11: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

11

Calculating Signature (2/2)

About to make orders

Organized API order

Page 12: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

12

REST service website https://hws.hicloud.hinet.net/cloud_hws/api/hws/? +${resultQuery}

Send API query string

Organized query string

Results

Page 13: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

13

Common Parameter

action:API orders to be executed.version:Version of the order (Current version:2013-03-29)chtAuthType:Authentication mechanism (hwspass)expires:The time of the expiration of calling time. ISO8601 time format is adopted YYYY-MM-DDThh:mm:ssZ accessKey:accessKey assigned to the customer.Captcha, to verify whether the call is legitimate.

Page 14: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

14

To Apply for a VM (1/3)

runInstances Corresponding order of runInstancesTo use a standard VM template

• Parameter– imageId:VM sample ID e.g. hi-qe4ug9ev– instanceType:Computing specification e.g.

HC1.XS.LINUX– monitoringEnabled– instanceName

To clone appointed VM• Parameter

– vm id

Page 15: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

15

To Apply for a VM (2/3)

Produced order strings

Related parameters for the application of VM

Page 16: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

16

To Apply for a VM (3/3)

To send back the ID of the order

The order of the new application

Page 17: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

17

To inquire for the VM data

To inquire for the VM :describeInstances Parameter

• businessServiceId或 orderUuid (If there is no such a parameter, it would inquire for the whole data.)

To inquire for the whole VM

Page 18: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

18

Results of the inquiry

Related VM data

Page 19: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

19

The operation of VM

Starting :startInstancesParameter: businessServiceId (Can be

plural)

Shutting down: stopInstancesParameter: businessServiceId (Can be

plural)

Rebooting : rebootInstancesParameter: businessServiceId (Can be

plural.)

Page 20: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

20

Starting a VM(1/2)

To start BV550100050 001 VM

Page 21: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

21

Starting a VM (2/2)

To start BV550100050001 VM.

Page 22: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

22

Shutting down a VM (1/2)

Shutting down order for VM BV550100050001

Page 23: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

23

Shutting down a VM (2/2)

VM BV550100050001 is shutting down

Page 24: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

24

Rebooting a VM (1/3)

To reboot VM BV550100050001

Page 25: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

25

Rebooting a VM (2/3)

VM BV550100050001 is shutting down

Page 26: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

26

Rebooting a VM (2/3)

VM BV550100050001 has been rebooted

Page 27: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

27

The change of VM attribute (1/4)

Related orders :modifyInstanceAttribute To provide a VM to be upgraded or degraded in the

original machine, or to provide the installment of monitoring function in a VM.

For the VM specification capable of the upgrading and degrading of the original machine, please see The List of Original Machine Upgrading and Degrading and Computing Specification.

Parameter• businessServiceId :Service ID of the changed VM.• instanceType:Computing Specification of the

changed.• monitoringEnabled:Whether a monitoring function is

operated (If there is instanceType in the parameter, the parameter of monitoring Enabled will be ignored.)

Page 28: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

28

The change of VM attribute (2/4)

The computing specification of the changed VM BV550100050001 is HC1. M.LINUX.

Page 29: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

29

The change of VM attribute (3/4)

The order of VM change is accepted

Page 30: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

30

VM Monitoring (1/3)

Related Order :getInstancesStats 參數 Paramter: businessServiceId (Can be plural)

To inquire for the monitoring data in VM BV550100050001

Page 31: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

31

VM Monitoring (2/3)

The monitoring data in VM BV550100050001

Page 32: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

32

LAB1

Entry of the logging in userTo apply a key.

Operation of OrderTo choose either one of the VM

application• imageId:hi-7ogdvkqh  instanceType:HC1.XS.WIN• imageId:hi-qe4ug9ev instanceType:HC1.XS.LINUX

To operate VM (start, shut down, reboot)To inquire for VM monitoring data. To upgrade or degrade the VM.To download VM passwords.

• To log in the VM.

Page 33: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

33

To copy a VM (1/2)

To clone VM BV550100050002

Page 34: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

34

To copy a VM (2/2)

The cloning is accepted

Page 35: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

35

To apply for load balance service (1/3)

Related order :createLoadBalancerPolicybusinessServiceIdport

80 port SLM is set up for two VMs

Page 36: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

36

To apply for load balance service (2/3)

It is accepted successfully.

Page 37: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

37

To inquire for load balance service (1/2)

Related order :describeLoadBalancerPoliciesbusinessServiceId (Can be plural.)

To inquire for all the load balance service.

Page 38: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

38

To inquire for load balance service (2/2)

To inquire for the load balancer service BL550100050001.

Page 39: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

39

The change in load balance (1/3)

Related order :replaceLoadBalancerPolicy Parameter

• businessServiceId:Load balance service ID.• instanceBusinessServiceId:VM service ID

• port

To change load balance service BL559199959991 into 81 port and change rip.

Page 40: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

40

The change in load balance (2/3)

It is successfully accepted.

Page 41: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

41

The change in load balance (3/3)

Page 42: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

42

To cancel load balance service (1/2)

Related order :deleteLoadBalancerPolicy Parameter: businessServiceId (Can be plural.)

To cancel load balancer service BL550100050001.

Page 43: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

43

To cancel load balance service (2/2)

The cancellation of load balancer service is accepted.

Page 44: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

44

To cancel VM (1/2)

Related Order :terminateInstances Parameter : businessServiceId (Can be plural.)

To cancel VM BL550100050001

Page 45: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

45

To cancel VM (2/2)

The cancellation of VM BL550100050001 is accepted.

Page 46: 1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go to CloudBOSS UP to apply for a set of API trial keys. To

46

LAB2

Operation of the ordersTo clone a VM.To apply for load balance.

• To test load balance.To inquire for load balance data.To change load balance.To cancel load balance.To cancel VM.