
    E0j1                     J    d dl mZ  G d de          Z G d de          ZdS )    )TeaModelc            3           e Zd ZdZdddddddddddddddddddddddddddededededed	ed
ededededededededededededededededededef2dZd Zd Z	d"d e
fd!ZdS )#Configz+
    Model for initializing credential
    N)typeaccess_key_idaccess_key_secretsecurity_tokenbearer_tokenduration_secondsrole_arnoidc_provider_arnoidc_token_file_pathrole_session_namerole_session_expirationpolicyexternal_idsts_endpointpublic_key_idprivate_key_file	role_nameenable_imds_v2disable_imds_v1metadata_token_durationcredentials_urihosttimeoutconnect_timeoutproxyr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c                d   || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        dS )a(	  
        Initialize the credential object.

        ### Parameters

        #### General Parameters
        - `type` (str): Credential type, including `access_key`, `sts`, `bearer`, `ecs_ram_role`, `ram_role_arn`, `rsa_key_pair`, `oidc_role_arn`, `credentials_uri`.

        #### Access Key Type
        - `access_key_id` (str): Access Key ID.
        - `access_key_secret` (str): Access Key Secret.
        - `security_token` (str, optional): Security token.

        #### Bearer Token Type
        - `bearer_token` (str): Bearer token.

        #### RAM Role ARN and OIDC Role ARN Types
        - `role_arn` (str): Role ARN.
        - `oidc_provider_arn` (str, for `oidc_role_arn` only): OIDC provider ARN.
        - `oidc_token_file_path` (str, for `oidc_role_arn` only): Path to the OIDC token file.
        - `role_session_name` (str): Role session name.
        - `role_session_expiration` (int, optional): Role session expiration time in seconds.
        - `policy` (str, optional): Policy.
        - `external_id` (str, optional): External ID.
        - `sts_endpoint` (str, optional): STS endpoint.
        - `duration_seconds`: deprecated

        #### RSA Key Pair Type
        - `public_key_id` (str): Public key ID.
        - `private_key_file` (str): Path to the private key file.

        #### ECS RAM Role Type
        - `role_name` (str): Role name.
        - `disable_imds_v1` (bool, optional): Whether to disable IMDS v1. Default is `False`.

        #### Credentials URI Type
        - `credentials_uri` (str): Credentials URI.

        #### HTTP Options
        - `host` (str, optional): Host address.
        - `timeout` (int, optional): Read timeout in milliseconds. Default values:
          - `ecs_ram_role`: 1000ms
          - `ram_role_arn`: 5000ms
          - `oidc_role_arn`: 5000ms
        - `connect_timeout` (int, optional): Connection timeout in milliseconds. Default values:
          - `ecs_ram_role`: 1000ms
          - `ram_role_arn`: 10000ms
          - `oidc_role_arn`: 10000ms
        - `proxy` (str, optional): HTTP or HTTPS proxy.

        #### Other Parameters
        - `duration_seconds` (int, optional): Duration in seconds, mainly used for `sts` type credentials.

        Note: Some parameters are only valid for specific credential types. Please use them according to your actual needs.
        N)r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )selfr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s                             g/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/alibabacloud_credentials/models.py__init__zConfig.__init__   s    h 	*!2,( 0 !2$8!!2'>$&(* 0".,'>$.	.


    c                     d S N r    s    r!   validatezConfig.validatey       r#   c                 t   t                      }| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j	        
| j	        |d	<   | j
        
| j
        |d
<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S Nr   accessKeyIdaccessKeySecretsecurityTokenbearerTokendurationSecondsroleArnoidcProviderArnoidcTokenFilePathroleSessionNameroleSessionExpirationr   
externalIdstsEndpointpublicKeyIdprivateKeyFileroleNamedisableIMDSv1enableIMDSv2metadataTokenDurationcredentialsUrir   r   connectTimeoutr   )dictr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r    results     r!   to_mapzConfig.to_map|   s/   9 !YF6N)$($6F=!!-(,(>F$%*&*&9F?#($($5F=! ,(,(=F$%=$ $F9!-(,(>F$%$0*.*CF&'!-(,(>F$%'3.2.JF*+;"#{F8'#'#3F< ($($5F=!)$($6F=! ,'+'<F#$>%!%F:+&*&:F?#*%)%8F>"'3.2.JF*++'+';F#$9 !YF6N<# $F9+'+';F#$:!"jF7Or#   mc                 T	   |pt                      }|                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _	        |                    d	          |                    d	          | _
        |                    d
          |                    d
          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        | S r+   )r@   getr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    rC   s     r!   from_mapzConfig.from_map   s   K55==$fDI55+!"}!5!5D55"##/%&UU+<%=%=D"55!!-"#%%"8"8D55+ !m 4 4D55"##/$%EE*;$<$<D!55'EE),,DM55"##/%&UU+<%=%=D"55$%%1().A(B(BD%55"##/%&UU+<%=%=D"55())5+,551H+I+ID(55??&%%//DK55* uu\22D55+ !m 4 4D55+!"}!5!5D55!"".$%EE*:$;$;D!55(UU:..DN55!!-#$55#9#9D 55  ,"#%%"7"7D55())5+,551H+I+ID(55!"".#$55)9#:#:D 55==$fDI55'55++DL55!"".#$55)9#:#:D 55>>%wDJr#   r%   )__name__
__module____qualname____doc__strintboolr"   r(   rB   r@   rG   r&   r#   r!   r   r      s         !%%)"& $$( %)(,%)+/# $!%$(!#'$(+/#'#'7l l l l 	l
  #l  l l "l l  #l #&l  #l &)l l l  !l" #l$ "%l& 'l( !)l* "+l, &)-l. !/l0 1l2 3l4 !5l6 7l l l l\  4 4 4l4 4$ 4 4 4 4 4 4r#   r   c                        e Zd Z	 	 	 	 	 	 ddedededededefdZd	 Zd
ef fdZddefdZd
efdZ	d
efdZ
d
efdZd
efdZd
efdZd
efdZ xZS )CredentialModelNr   r   r	   r
   r   provider_namec                 Z    || _         || _        || _        || _        || _        || _        d S r%   )r   r   r	   r
   r   rQ   )r    r   r   r	   r
   r   rQ   s          r!   r"   zCredentialModel.__init__   s9     +!2,(	*r#   c                     d S r%   r&   r'   s    r!   r(   zCredentialModel.validate   r)   r#   returnc                 8   t                                                      }||S t                      }| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S Nr,   r-   r.   r/   r   providerName)	superrB   r@   r   r   r	   r
   r   rQ   )r    _maprA   	__class__s      r!   rB   zCredentialModel.to_map  s    ww~~K)$($6F=!!-(,(>F$%*&*&9F?#($($5F=!9 !YF6N)%)%7F>"r#   rC   c                 Z   |pt                      }|                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        |                    d          |                    d          | _        | S rV   )r@   rE   r   r   r	   r
   r   rQ   rF   s     r!   rG   zCredentialModel.from_map  s    K55+!"}!5!5D55"##/%&UU+<%=%=D"55!!-"#%%"8"8D55+ !m 4 4D55==$fDI55  ,!"~!6!6Dr#   c                     | j         S r%   )r   r'   s    r!   get_access_key_idz!CredentialModel.get_access_key_id'      !!r#   c                     | j         S r%   )r   r'   s    r!   get_access_key_secretz%CredentialModel.get_access_key_secret*  s    %%r#   c                     | j         S r%   )r	   r'   s    r!   get_security_tokenz"CredentialModel.get_security_token-  s    ""r#   c                     | j         S r%   )r
   r'   s    r!   get_bearer_tokenz CredentialModel.get_bearer_token0  s      r#   c                     | j         S r%   )r   r'   s    r!   get_typezCredentialModel.get_type3  s
    yr#   c                     | j         S r%   )rQ   r'   s    r!   get_provider_namez!CredentialModel.get_provider_name6  r^   r#   )NNNNNNr%   )rH   rI   rJ   rL   r"   r(   r@   rB   rG   r]   r`   rb   rd   rf   rh   __classcell__)rZ   s   @r!   rP   rP      s|        "&%)"& $!%+ ++  #+  	+
 + + + + + +,        ( $     "3 " " " "&s & & & &#C # # # #!# ! ! ! !#    "3 " " " " " " " "r#   rP   N)	Tea.modelr   r   rP   r&   r#   r!   <module>rk      s         ` ` ` ` `X ` ` `FN" N" N" N" N"h N" N" N" N" N"r#   