Forráskód Böngészése

Generated 2019-09-01 for ahas-openapi.

sdk-team 5 éve
szülő
commit
8c4e7e720c

+ 4 - 0
ChangeLog.txt

@@ -1,3 +1,7 @@
+2020-03-24 Version: v1.61.75
+- Generated 2019-09-01 for `ahas-openapi`.
+
+
 2020-03-24 Version: v1.61.74
 - Generated 2018-10-10 for `Yundun-bastionhost`.
 

+ 129 - 0
services/ahas-openapi/client.go

@@ -0,0 +1,129 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"reflect"
+
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
+)
+
+// Client is the sdk client struct, each func corresponds to an OpenAPI
+type Client struct {
+	sdk.Client
+}
+
+// SetClientProperty Set Property by Reflect
+func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) {
+	v := reflect.ValueOf(client).Elem()
+	if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() {
+		v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue))
+	}
+}
+
+// SetEndpointDataToClient Set EndpointMap and ENdpointType
+func SetEndpointDataToClient(client *Client) {
+	SetClientProperty(client, "EndpointMap", GetEndpointMap())
+	SetClientProperty(client, "EndpointType", GetEndpointType())
+}
+
+// NewClient creates a sdk client with environment variables
+func NewClient() (client *Client, err error) {
+	client = &Client{}
+	err = client.Init()
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithProvider creates a sdk client with providers
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) {
+	client = &Client{}
+	var pc provider.Provider
+	if len(providers) == 0 {
+		pc = provider.DefaultChain
+	} else {
+		pc = provider.NewProviderChain(providers)
+	}
+	err = client.InitWithProviderChain(regionId, pc)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
+// this is the common api to create a sdk client
+func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithOptions(regionId, config, credential)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithStsToken is a shortcut to create sdk client with sts token
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithEcsRamRole(regionId, roleName)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
+	SetEndpointDataToClient(client)
+	return
+}

+ 107 - 0
services/ahas-openapi/describe_regions.go

@@ -0,0 +1,107 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// DescribeRegions invokes the ahas_openapi.DescribeRegions API synchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/describeregions.html
+func (client *Client) DescribeRegions(request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) {
+	response = CreateDescribeRegionsResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// DescribeRegionsWithChan invokes the ahas_openapi.DescribeRegions API asynchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/describeregions.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DescribeRegionsWithChan(request *DescribeRegionsRequest) (<-chan *DescribeRegionsResponse, <-chan error) {
+	responseChan := make(chan *DescribeRegionsResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.DescribeRegions(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// DescribeRegionsWithCallback invokes the ahas_openapi.DescribeRegions API asynchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/describeregions.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) DescribeRegionsWithCallback(request *DescribeRegionsRequest, callback func(response *DescribeRegionsResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *DescribeRegionsResponse
+		var err error
+		defer close(result)
+		response, err = client.DescribeRegions(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// DescribeRegionsRequest is the request struct for api DescribeRegions
+type DescribeRegionsRequest struct {
+	*requests.RpcRequest
+	AcceptLanguage string `position:"Query" name:"AcceptLanguage"`
+}
+
+// DescribeRegionsResponse is the response struct for api DescribeRegions
+type DescribeRegionsResponse struct {
+	*responses.BaseResponse
+	RequestId string `json:"RequestId" xml:"RequestId"`
+	Code      string `json:"Code" xml:"Code"`
+	Success   bool   `json:"Success" xml:"Success"`
+	Message   string `json:"Message" xml:"Message"`
+	Regions   []Data `json:"Regions" xml:"Regions"`
+}
+
+// CreateDescribeRegionsRequest creates a request to invoke DescribeRegions API
+func CreateDescribeRegionsRequest() (request *DescribeRegionsRequest) {
+	request = &DescribeRegionsRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("ahas-openapi", "2019-09-01", "DescribeRegions", "ahas", "openAPI")
+	return
+}
+
+// CreateDescribeRegionsResponse creates a response to parse from DescribeRegions response
+func CreateDescribeRegionsResponse() (response *DescribeRegionsResponse) {
+	response = &DescribeRegionsResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 26 - 0
services/ahas-openapi/endpoint.go

@@ -0,0 +1,26 @@
+package ahas_openapi
+
+// EndpointMap Endpoint Data
+var EndpointMap map[string]string
+
+// EndpointType regional or central
+var EndpointType = "regional"
+
+// GetEndpointMap Get Endpoint Data Map
+func GetEndpointMap() map[string]string {
+	if EndpointMap == nil {
+		EndpointMap = map[string]string{
+			"cn-shenzhen": "ahas.cn-shenzhen.aliyuncs.com",
+			"cn-beijing":  "ahas.cn-beijing.aliyuncs.com",
+			"cn-shanghai": "ahas.cn-shanghai.aliyuncs.com",
+			"cn-hongkong": "ahas.cn-hongkong.aliyuncs.com",
+			"cn-hangzhou": "ahas.cn-hangzhou.aliyuncs.com",
+		}
+	}
+	return EndpointMap
+}
+
+// GetEndpointType Get Endpoint Type Value
+func GetEndpointType() string {
+	return EndpointType
+}

+ 111 - 0
services/ahas-openapi/get_sentinel_app_sum_metric.go

@@ -0,0 +1,111 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// GetSentinelAppSumMetric invokes the ahas_openapi.GetSentinelAppSumMetric API synchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/getsentinelappsummetric.html
+func (client *Client) GetSentinelAppSumMetric(request *GetSentinelAppSumMetricRequest) (response *GetSentinelAppSumMetricResponse, err error) {
+	response = CreateGetSentinelAppSumMetricResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// GetSentinelAppSumMetricWithChan invokes the ahas_openapi.GetSentinelAppSumMetric API asynchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/getsentinelappsummetric.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetSentinelAppSumMetricWithChan(request *GetSentinelAppSumMetricRequest) (<-chan *GetSentinelAppSumMetricResponse, <-chan error) {
+	responseChan := make(chan *GetSentinelAppSumMetricResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.GetSentinelAppSumMetric(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// GetSentinelAppSumMetricWithCallback invokes the ahas_openapi.GetSentinelAppSumMetric API asynchronously
+// api document: https://help.aliyun.com/api/ahas-openapi/getsentinelappsummetric.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetSentinelAppSumMetricWithCallback(request *GetSentinelAppSumMetricRequest, callback func(response *GetSentinelAppSumMetricResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *GetSentinelAppSumMetricResponse
+		var err error
+		defer close(result)
+		response, err = client.GetSentinelAppSumMetric(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// GetSentinelAppSumMetricRequest is the request struct for api GetSentinelAppSumMetric
+type GetSentinelAppSumMetricRequest struct {
+	*requests.RpcRequest
+	EndTime        string `position:"Query" name:"EndTime"`
+	StartTime      string `position:"Query" name:"StartTime"`
+	AppName        string `position:"Query" name:"AppName"`
+	AcceptLanguage string `position:"Query" name:"AcceptLanguage"`
+	Namespace      string `position:"Query" name:"Namespace"`
+}
+
+// GetSentinelAppSumMetricResponse is the response struct for api GetSentinelAppSumMetric
+type GetSentinelAppSumMetricResponse struct {
+	*responses.BaseResponse
+	RequestId  string     `json:"RequestId" xml:"RequestId"`
+	Code       string     `json:"Code" xml:"Code"`
+	Success    bool       `json:"Success" xml:"Success"`
+	Message    string     `json:"Message" xml:"Message"`
+	MetricData MetricData `json:"MetricData" xml:"MetricData"`
+}
+
+// CreateGetSentinelAppSumMetricRequest creates a request to invoke GetSentinelAppSumMetric API
+func CreateGetSentinelAppSumMetricRequest() (request *GetSentinelAppSumMetricRequest) {
+	request = &GetSentinelAppSumMetricRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("ahas-openapi", "2019-09-01", "GetSentinelAppSumMetric", "ahas", "openAPI")
+	return
+}
+
+// CreateGetSentinelAppSumMetricResponse creates a response to parse from GetSentinelAppSumMetric response
+func CreateGetSentinelAppSumMetricResponse() (response *GetSentinelAppSumMetricResponse) {
+	response = &GetSentinelAppSumMetricResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 23 - 0
services/ahas-openapi/struct_data.go

@@ -0,0 +1,23 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// Data is a nested struct in ahas_openapi response
+type Data struct {
+	RegionId       string `json:"RegionId" xml:"RegionId"`
+	RegionEndpoint string `json:"RegionEndpoint" xml:"RegionEndpoint"`
+	LocalName      string `json:"LocalName" xml:"LocalName"`
+}

+ 28 - 0
services/ahas-openapi/struct_metric_data.go

@@ -0,0 +1,28 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// MetricData is a nested struct in ahas_openapi response
+type MetricData struct {
+	UserId       string  `json:"UserId" xml:"UserId"`
+	Namespace    string  `json:"Namespace" xml:"Namespace"`
+	AppName      string  `json:"AppName" xml:"AppName"`
+	PassCount    float64 `json:"PassCount" xml:"PassCount"`
+	BlockCount   float64 `json:"BlockCount" xml:"BlockCount"`
+	TotalCount   float64 `json:"TotalCount" xml:"TotalCount"`
+	AvgRt        float64 `json:"AvgRt" xml:"AvgRt"`
+	MachineCount int64   `json:"MachineCount" xml:"MachineCount"`
+}

+ 21 - 0
services/ahas-openapi/struct_regions.go

@@ -0,0 +1,21 @@
+package ahas_openapi
+
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// Regions is a nested struct in ahas_openapi response
+type Regions struct {
+	Data []Data `json:"Data" xml:"Data"`
+}