1 Directions for API 游志誠 risc@cht.com.tw. 2 Steps for Trials (Users)(1/5) How to begin? To go...

Preview:

Citation preview

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 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

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.

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.

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.

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.

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.

8

Calling API by REST Client

ToolsFirefox with RESTClient plug-in (or other

REST Client)JsonView

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.

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.

11

Calculating Signature (2/2)

About to make orders

Organized API order

12

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

Send API query string

Organized query string

Results

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.

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

15

To Apply for a VM (2/3)

Produced order strings

Related parameters for the application of VM

16

To Apply for a VM (3/3)

To send back the ID of the order

The order of the new application

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

18

Results of the inquiry

Related VM data

19

The operation of VM

Starting :startInstancesParameter: businessServiceId (Can be

plural)

Shutting down: stopInstancesParameter: businessServiceId (Can be

plural)

Rebooting : rebootInstancesParameter: businessServiceId (Can be

plural.)

20

Starting a VM(1/2)

To start BV550100050 001 VM

21

Starting a VM (2/2)

To start BV550100050001 VM.

22

Shutting down a VM (1/2)

Shutting down order for VM BV550100050001

23

Shutting down a VM (2/2)

VM BV550100050001 is shutting down

24

Rebooting a VM (1/3)

To reboot VM BV550100050001

25

Rebooting a VM (2/3)

VM BV550100050001 is shutting down

26

Rebooting a VM (2/3)

VM BV550100050001 has been rebooted

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.)

28

The change of VM attribute (2/4)

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

29

The change of VM attribute (3/4)

The order of VM change is accepted

30

VM Monitoring (1/3)

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

To inquire for the monitoring data in VM BV550100050001

31

VM Monitoring (2/3)

The monitoring data in VM BV550100050001

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.

33

To copy a VM (1/2)

To clone VM BV550100050002

34

To copy a VM (2/2)

The cloning is accepted

35

To apply for load balance service (1/3)

Related order :createLoadBalancerPolicybusinessServiceIdport

80 port SLM is set up for two VMs

36

To apply for load balance service (2/3)

It is accepted successfully.

37

To inquire for load balance service (1/2)

Related order :describeLoadBalancerPoliciesbusinessServiceId (Can be plural.)

To inquire for all the load balance service.

38

To inquire for load balance service (2/2)

To inquire for the load balancer service BL550100050001.

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.

40

The change in load balance (2/3)

It is successfully accepted.

41

The change in load balance (3/3)

42

To cancel load balance service (1/2)

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

To cancel load balancer service BL550100050001.

43

To cancel load balance service (2/2)

The cancellation of load balancer service is accepted.

44

To cancel VM (1/2)

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

To cancel VM BL550100050001

45

To cancel VM (2/2)

The cancellation of VM BL550100050001 is accepted.

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.

Recommended