1package emr
2
3//Licensed under the Apache License, Version 2.0 (the "License");
4//you may not use this file except in compliance with the License.
5//You may obtain a copy of the License at
6//
7//http://www.apache.org/licenses/LICENSE-2.0
8//
9//Unless required by applicable law or agreed to in writing, software
10//distributed under the License is distributed on an "AS IS" BASIS,
11//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//See the License for the specific language governing permissions and
13//limitations under the License.
14//
15// Code generated by Alibaba Cloud SDK Code Generator.
16// Changes may cause incorrect behavior and will be lost if the code is regenerated.
17
18import (
19	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
20	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
21)
22
23// Client is the sdk client struct, each func corresponds to an OpenAPI
24type Client struct {
25	sdk.Client
26}
27
28// NewClient creates a sdk client with environment variables
29func NewClient() (client *Client, err error) {
30	client = &Client{}
31	err = client.Init()
32	return
33}
34
35// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
36// this is the common api to create a sdk client
37func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
38	client = &Client{}
39	err = client.InitWithOptions(regionId, config, credential)
40	return
41}
42
43// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
44// usage: https://help.aliyun.com/document_detail/66217.html
45func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
46	client = &Client{}
47	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
48	return
49}
50
51// NewClientWithStsToken is a shortcut to create sdk client with sts token
52// usage: https://help.aliyun.com/document_detail/66222.html
53func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
54	client = &Client{}
55	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
56	return
57}
58
59// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
60// usage: https://help.aliyun.com/document_detail/66222.html
61func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
62	client = &Client{}
63	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
64	return
65}
66
67// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
68// usage: https://help.aliyun.com/document_detail/66223.html
69func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
70	client = &Client{}
71	err = client.InitWithEcsRamRole(regionId, roleName)
72	return
73}
74
75// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
76// attention: rsa key pair auth is only Japan regions available
77func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
78	client = &Client{}
79	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
80	return
81}
82