// Copyright (c) 2017-2025 Tencent. All Rights Reserved.
//
// 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.

package v20180813

import (
    tcerr "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/errors"
    tchttp "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/http"
    "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/json"
)

// Predefined struct for user
type AssumeRoleRequestParams struct {
	// Resource descriptions of a role, which can be obtained by clicking the role name in the [CAM console](https://console.cloud.tencent.com/cam/role).
	// General role:
	// qcs::cam::uin/12345678:role/4611686018427397919, qcs::cam::uin/12345678:roleName/testRoleName
	// Service role:
	// qcs::cam::uin/12345678:role/tencentcloudServiceRole/4611686018427397920, qcs::cam::uin/12345678:role/tencentcloudServiceRoleName/testServiceRoleName
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// User-defined temporary session name.
	// It can contain 2-128 letters, digits, and symbols (=,.@_-). Regex: [\w+=,.@_-]*
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`

	// Policy description
	// 
	// Note:
	// 
	// This parameter needs to be URL-encoded. The server will URL-decode this field and grant temporary access credentials based on the processed policy. Please pass the parameter according to the specification. (If you request a TencentCloud API through the GET method, all parameters must be URL-encoded again in accordance with [Signature v3](https://intl.cloud.tencent.com/document/api/598/33159?from_cn_redirect=1#1.-.E6.8B.BC.E6.8E.A5.E8.A7.84.E8.8C.83.E8.AF.B7.E6.B1.82.E4.B8.B2) before the request is sent).
	// The policy syntax refers to [CAM's Syntax Logic](https://intl.cloud.tencent.com/document/product/598/10603?from_cn_redirect=1).
	// 3. The policy cannot contain the `principal` element.
	Policy *string `json:"Policy,omitnil,omitempty" name:"Policy"`

	// External role ID, which can be obtained by clicking the role name in the [CAM console](https://console.cloud.tencent.com/cam/role).
	// It can contain 2-128 letters, digits, and symbols (=,.@:/-). Regex: [\w+=,.@:\/-]*
	ExternalId *string `json:"ExternalId,omitnil,omitempty" name:"ExternalId"`

	// List of session tags. Up to 50 tags are allowed. The tag keys can not duplicate.
	Tags []*Tag `json:"Tags,omitnil,omitempty" name:"Tags"`

	// UIN of the initiator
	SourceIdentity *string `json:"SourceIdentity,omitnil,omitempty" name:"SourceIdentity"`


	SerialNumber *string `json:"SerialNumber,omitnil,omitempty" name:"SerialNumber"`


	TokenCode *string `json:"TokenCode,omitnil,omitempty" name:"TokenCode"`
}

type AssumeRoleRequest struct {
	*tchttp.BaseRequest
	
	// Resource descriptions of a role, which can be obtained by clicking the role name in the [CAM console](https://console.cloud.tencent.com/cam/role).
	// General role:
	// qcs::cam::uin/12345678:role/4611686018427397919, qcs::cam::uin/12345678:roleName/testRoleName
	// Service role:
	// qcs::cam::uin/12345678:role/tencentcloudServiceRole/4611686018427397920, qcs::cam::uin/12345678:role/tencentcloudServiceRoleName/testServiceRoleName
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// User-defined temporary session name.
	// It can contain 2-128 letters, digits, and symbols (=,.@_-). Regex: [\w+=,.@_-]*
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`

	// Policy description
	// 
	// Note:
	// 
	// This parameter needs to be URL-encoded. The server will URL-decode this field and grant temporary access credentials based on the processed policy. Please pass the parameter according to the specification. (If you request a TencentCloud API through the GET method, all parameters must be URL-encoded again in accordance with [Signature v3](https://intl.cloud.tencent.com/document/api/598/33159?from_cn_redirect=1#1.-.E6.8B.BC.E6.8E.A5.E8.A7.84.E8.8C.83.E8.AF.B7.E6.B1.82.E4.B8.B2) before the request is sent).
	// The policy syntax refers to [CAM's Syntax Logic](https://intl.cloud.tencent.com/document/product/598/10603?from_cn_redirect=1).
	// 3. The policy cannot contain the `principal` element.
	Policy *string `json:"Policy,omitnil,omitempty" name:"Policy"`

	// External role ID, which can be obtained by clicking the role name in the [CAM console](https://console.cloud.tencent.com/cam/role).
	// It can contain 2-128 letters, digits, and symbols (=,.@:/-). Regex: [\w+=,.@:\/-]*
	ExternalId *string `json:"ExternalId,omitnil,omitempty" name:"ExternalId"`

	// List of session tags. Up to 50 tags are allowed. The tag keys can not duplicate.
	Tags []*Tag `json:"Tags,omitnil,omitempty" name:"Tags"`

	// UIN of the initiator
	SourceIdentity *string `json:"SourceIdentity,omitnil,omitempty" name:"SourceIdentity"`

	SerialNumber *string `json:"SerialNumber,omitnil,omitempty" name:"SerialNumber"`

	TokenCode *string `json:"TokenCode,omitnil,omitempty" name:"TokenCode"`
}

func (r *AssumeRoleRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "RoleArn")
	delete(f, "RoleSessionName")
	delete(f, "DurationSeconds")
	delete(f, "Policy")
	delete(f, "ExternalId")
	delete(f, "Tags")
	delete(f, "SourceIdentity")
	delete(f, "SerialNumber")
	delete(f, "TokenCode")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "AssumeRoleRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type AssumeRoleResponseParams struct {
	// Temporary access credentials
	Credentials *Credentials `json:"Credentials,omitnil,omitempty" name:"Credentials"`

	// Expiration time of the temporary access credentials. A Unix timestamp will be returned which is accurate to the second.
	ExpiredTime *int64 `json:"ExpiredTime,omitnil,omitempty" name:"ExpiredTime"`

	// Expiration time of the temporary access credentials in UTC time in ISO 8601 format.
	Expiration *string `json:"Expiration,omitnil,omitempty" name:"Expiration"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type AssumeRoleResponse struct {
	*tchttp.BaseResponse
	Response *AssumeRoleResponseParams `json:"Response"`
}

func (r *AssumeRoleResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type AssumeRoleWithSAMLRequestParams struct {
	// Base64-encoded SAML assertion
	SAMLAssertion *string `json:"SAMLAssertion,omitnil,omitempty" name:"SAMLAssertion"`

	// Principal access description name
	PrincipalArn *string `json:"PrincipalArn,omitnil,omitempty" name:"PrincipalArn"`

	// Role access description name
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// Session name
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

type AssumeRoleWithSAMLRequest struct {
	*tchttp.BaseRequest
	
	// Base64-encoded SAML assertion
	SAMLAssertion *string `json:"SAMLAssertion,omitnil,omitempty" name:"SAMLAssertion"`

	// Principal access description name
	PrincipalArn *string `json:"PrincipalArn,omitnil,omitempty" name:"PrincipalArn"`

	// Role access description name
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// Session name
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

func (r *AssumeRoleWithSAMLRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleWithSAMLRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "SAMLAssertion")
	delete(f, "PrincipalArn")
	delete(f, "RoleArn")
	delete(f, "RoleSessionName")
	delete(f, "DurationSeconds")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "AssumeRoleWithSAMLRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type AssumeRoleWithSAMLResponseParams struct {
	// An object consists of the `Token`, `TmpSecretId`, and `TmpSecretId`
	Credentials *Credentials `json:"Credentials,omitnil,omitempty" name:"Credentials"`

	// Indicates the expiration time of the temporary access credentials. A Unix timestamp will be returned which is accurate to the second.
	ExpiredTime *uint64 `json:"ExpiredTime,omitnil,omitempty" name:"ExpiredTime"`

	// Indicates the expiration time of the temporary access credentials in UTC time in ISO 8601 format.
	Expiration *string `json:"Expiration,omitnil,omitempty" name:"Expiration"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type AssumeRoleWithSAMLResponse struct {
	*tchttp.BaseResponse
	Response *AssumeRoleWithSAMLResponseParams `json:"Response"`
}

func (r *AssumeRoleWithSAMLResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleWithSAMLResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type AssumeRoleWithWebIdentityRequestParams struct {
	// Identity provider name
	ProviderId *string `json:"ProviderId,omitnil,omitempty" name:"ProviderId"`

	// OIDC token issued by the IdP
	WebIdentityToken *string `json:"WebIdentityToken,omitnil,omitempty" name:"WebIdentityToken"`

	// Role access description name
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// Session name
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *int64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

type AssumeRoleWithWebIdentityRequest struct {
	*tchttp.BaseRequest
	
	// Identity provider name
	ProviderId *string `json:"ProviderId,omitnil,omitempty" name:"ProviderId"`

	// OIDC token issued by the IdP
	WebIdentityToken *string `json:"WebIdentityToken,omitnil,omitempty" name:"WebIdentityToken"`

	// Role access description name
	RoleArn *string `json:"RoleArn,omitnil,omitempty" name:"RoleArn"`

	// Session name
	RoleSessionName *string `json:"RoleSessionName,omitnil,omitempty" name:"RoleSessionName"`

	// Specifies the validity period of the temporary access credentials in seconds. Default value: 7,200s. Maximum value: 43,200s.
	DurationSeconds *int64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

func (r *AssumeRoleWithWebIdentityRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleWithWebIdentityRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ProviderId")
	delete(f, "WebIdentityToken")
	delete(f, "RoleArn")
	delete(f, "RoleSessionName")
	delete(f, "DurationSeconds")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "AssumeRoleWithWebIdentityRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type AssumeRoleWithWebIdentityResponseParams struct {
	// Expiration time of the temporary access credentials (timestamp).
	ExpiredTime *uint64 `json:"ExpiredTime,omitnil,omitempty" name:"ExpiredTime"`

	// Expiration time of the temporary access credentials.
	Expiration *string `json:"Expiration,omitnil,omitempty" name:"Expiration"`

	// Temporary access credentials
	Credentials *Credentials `json:"Credentials,omitnil,omitempty" name:"Credentials"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type AssumeRoleWithWebIdentityResponse struct {
	*tchttp.BaseResponse
	Response *AssumeRoleWithWebIdentityResponseParams `json:"Response"`
}

func (r *AssumeRoleWithWebIdentityResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *AssumeRoleWithWebIdentityResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

type Credentials struct {
	// Token, which contains up to 4,096 bytes depending on the associated policies.
	Token *string `json:"Token,omitnil,omitempty" name:"Token"`

	// Temporary credentials key ID, which contains up to 1,024 bytes.
	TmpSecretId *string `json:"TmpSecretId,omitnil,omitempty" name:"TmpSecretId"`

	// Temporary credentials key, which contains up to 1,024 bytes.
	TmpSecretKey *string `json:"TmpSecretKey,omitnil,omitempty" name:"TmpSecretKey"`
}

// Predefined struct for user
type GetCallerIdentityRequestParams struct {

}

type GetCallerIdentityRequest struct {
	*tchttp.BaseRequest
	
}

func (r *GetCallerIdentityRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *GetCallerIdentityRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "GetCallerIdentityRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type GetCallerIdentityResponseParams struct {
	// ARN of the current caller.
	Arn *string `json:"Arn,omitnil,omitempty" name:"Arn"`

	// Root account UIN of the current caller.
	AccountId *string `json:"AccountId,omitnil,omitempty" name:"AccountId"`

	// User ID.
	// 1. If the caller is a Tencent Cloud account, the UIN of the current account is returned.
	// 2. If the caller is a role, `roleId:roleSessionName` is returned.
	// 3. If the caller is a federated user, `uin:federatedUserName` is returned.
	UserId *string `json:"UserId,omitnil,omitempty" name:"UserId"`

	// Account UIN.
	// 1. If the caller is a Tencent Cloud account, the UIN of the current account is returned.
	// 2. If the caller is a role, the UIN of the account that applies for the role is returned.
	PrincipalId *string `json:"PrincipalId,omitnil,omitempty" name:"PrincipalId"`

	// Identity type.
	Type *string `json:"Type,omitnil,omitempty" name:"Type"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type GetCallerIdentityResponse struct {
	*tchttp.BaseResponse
	Response *GetCallerIdentityResponseParams `json:"Response"`
}

func (r *GetCallerIdentityResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *GetCallerIdentityResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type GetFederationTokenRequestParams struct {
	// The customizable name of the caller, consisting of letters
	Name *string `json:"Name,omitnil,omitempty" name:"Name"`

	// Note:
	// 
	// The policy syntax refers to [CAM's Syntax Logic](https://intl.cloud.tencent.com/document/product/598/10603?from_cn_redirect=1).
	// The policy cannot contain the principal element.
	// This parameter needs to be URL-encoded. The server will URL-decode this field and grant temporary access credentials based on the processed policy. Please pass the parameter according to the specification.
	Policy *string `json:"Policy,omitnil,omitempty" name:"Policy"`

	// The validity period of temporary credentials in seconds. Default value: 1,800s. Maximum value for a root account: 7,200s. Maximum value for a sub-account: 129,600s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

type GetFederationTokenRequest struct {
	*tchttp.BaseRequest
	
	// The customizable name of the caller, consisting of letters
	Name *string `json:"Name,omitnil,omitempty" name:"Name"`

	// Note:
	// 
	// The policy syntax refers to [CAM's Syntax Logic](https://intl.cloud.tencent.com/document/product/598/10603?from_cn_redirect=1).
	// The policy cannot contain the principal element.
	// This parameter needs to be URL-encoded. The server will URL-decode this field and grant temporary access credentials based on the processed policy. Please pass the parameter according to the specification.
	Policy *string `json:"Policy,omitnil,omitempty" name:"Policy"`

	// The validity period of temporary credentials in seconds. Default value: 1,800s. Maximum value for a root account: 7,200s. Maximum value for a sub-account: 129,600s.
	DurationSeconds *uint64 `json:"DurationSeconds,omitnil,omitempty" name:"DurationSeconds"`
}

func (r *GetFederationTokenRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *GetFederationTokenRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "Name")
	delete(f, "Policy")
	delete(f, "DurationSeconds")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "GetFederationTokenRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type GetFederationTokenResponseParams struct {
	// Temporary access credentials
	Credentials *Credentials `json:"Credentials,omitnil,omitempty" name:"Credentials"`

	// Temporary access credentials expiration time. A Unix timestamp will be returned which is accurate to the second.
	ExpiredTime *uint64 `json:"ExpiredTime,omitnil,omitempty" name:"ExpiredTime"`

	// Temporary access credentials expiration time in UTC time in ISO 8601 format.
	// Note: this field may return null, indicating that no valid values can be obtained.
	Expiration *string `json:"Expiration,omitnil,omitempty" name:"Expiration"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type GetFederationTokenResponse struct {
	*tchttp.BaseResponse
	Response *GetFederationTokenResponseParams `json:"Response"`
}

func (r *GetFederationTokenResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *GetFederationTokenResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

type Tag struct {
	// Tag key. It’s up to 128 characters and case-sensitive.
	Key *string `json:"Key,omitnil,omitempty" name:"Key"`

	// Tag value. It’s up to 256 characters and case-sensitive.
	Value *string `json:"Value,omitnil,omitempty" name:"Value"`
}