Example #1
0
func RequestAPI(params map[string]string) (string, error) {
	query := util.GetQueryFromMap(params)
	req := &util.AliyunRequest{}
	req.Url = ECSHost + query
	log.Debug(req.Url)
	result, err := req.DoGetRequest()
	return result, err
}
Example #2
0
func (c *CommonParam) RequestAPI(params map[string]interface{}) (string, error) {
	query := GetQueryFromMap(params)
	req := &AliyunRequest{}
	req.Url = c.Host + query
	log.Debug(req.Url)
	result, err := req.DoGetRequest()
	return result, err
}
Example #3
0
func (c *CommonParam) Request(action string, params map[string]string, response interface{}) error {
	p := c.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), response)
	return nil
}
Example #4
0
func (op *OtherOperator) DescribeInstanceTypes(params map[string]string) (DescribeInstanceTypesResponse, error) {
	var resp DescribeInstanceTypesResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return DescribeInstanceTypesResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #5
0
func (op *ImageOperator) ModifyImageSharePermission(params map[string]string) (ModifyImageSharePermissionResponse, error) {
	var resp ModifyImageSharePermissionResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return ModifyImageSharePermissionResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #6
0
func (op *ImageOperator) CancelCopyImage(params map[string]string) (CancelCopyImageResponse, error) {
	var resp CancelCopyImageResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return CancelCopyImageResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #7
0
func (op *SecurityGroupOperator) RevokeSecurityGroupEgress(params map[string]string) (RevokeSecurityGroupEgressResponse, error) {
	var resp RevokeSecurityGroupEgressResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return RevokeSecurityGroupEgressResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #8
0
func (op *DiskOperator) ReplaceSystemDisk(params map[string]string) (ReplaceSystemDiskResponse, error) {
	var resp ReplaceSystemDiskResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return ReplaceSystemDiskResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #9
0
func (op *SnapshotOperator) ModifyAutoSnapshotPolicy(params map[string]string) (ModifyAutoSnapshotPolicyResponse, error) {
	var resp ModifyAutoSnapshotPolicyResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return ModifyAutoSnapshotPolicyResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #10
0
func (op *NetworkOperator) AllocatePublicIpAddress(params map[string]string) (AllocatePublicIpAddressResponse, error) {
	var resp AllocatePublicIpAddressResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return AllocatePublicIpAddressResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}
Example #11
0
func (op *NetworkOperator) ModifyEipAddressAttribute(params map[string]string) (ModifyEipAddressAttributeResponse, error) {
	var resp ModifyEipAddressAttributeResponse
	action := GetFuncName(1)
	p := op.Common.ResolveAllParams(action, params)
	result, err := RequestAPI(p)
	if err != nil {
		return ModifyEipAddressAttributeResponse{}, err
	}
	log.Debug(result)
	json.Unmarshal([]byte(result), &resp)
	return resp, nil
}