carlogtt_python_library.amazon_internal.simt module
This module …
- class carlogtt_python_library.amazon_internal.simt.SimT(aws_region_name: str, *, aws_profile_name: str | None = None, aws_access_key_id: str | None = None, aws_secret_access_key: str | None = None, aws_session_token: str | None = None, caching: bool = False, client_parameters: dict[str, Any] | None = None, aws_account_id: str = 'default', ticketing_system_name: str = 'default')[source]
Bases:
objectA handler class for the TicketyPythonSdk.
It includes an option to cache the client session to minimize the number of AWS API call.
- Parameters:
aws_region_name – The name of the AWS region where the service is to be used. This parameter is required to configure the AWS client.
aws_account_id – The AWS Account ID name for the target ticketing system. Use “default” unless you are targeting an integ environment. https://w.amazon.com/bin/view/IssueManagement/SIMTicketing/TicketyAPI/FAQ/#HCanIuseTicketyAPItoaccessintegdata3F
ticketing_system_name – The Ticketing System for the target ticketing system. Use “default” unless you are targeting an integ environment. https://w.amazon.com/bin/view/IssueManagement/SIMTicketing/TicketyAPI/FAQ/#HCanIuseTicketyAPItoaccessintegdata3F
aws_profile_name – The name of the AWS profile to use for credentials. This is useful if you have multiple profiles configured in your AWS credentials file. Default is None, which means the default profile or environment variables will be used if not provided.
aws_access_key_id – The AWS access key ID for programmatically accessing AWS services. This parameter is optional and only needed if not using a profile from the AWS credentials file.
aws_secret_access_key – The AWS secret access key corresponding to the provided access key ID. Like the access key ID, this parameter is optional and only needed if not using a profile.
aws_session_token – The AWS temporary session token corresponding to the provided access key ID. Like the access key ID, this parameter is optional and only needed if not using a profile.
caching – Determines whether to enable caching for the client session. If set to True, the client session will be cached to improve performance and reduce the number of API calls. Default is False.
client_parameters – A key-value pair object of parameters that will be passed to the low-level service client.
- create_ticket(ticket_data: dict[str, Any]) str[source]
Create a ticket in the ticketing system and return the ticket ID.
- Parameters:
ticket_data
- Returns:
The ticket ID.
- create_ticket_comment(ticket_id: str, comment: str, thread_name: str = 'CORRESPONDENCE', content_type: str = 'text/amz-markdown-sim') str[source]
Updates a ticket in the ticketing system.
- Parameters:
ticket_id – The ticket ID.
thread_name – Must be one of these 3: “CORRESPONDENCE” “WORKLOG” “ANNOUNCEMENTS”. Auto default to “CORRESPONDENCE”.
comment – The comment to post. Between 3 and 60_000 characters.
content_type – Must be one of these 2: “text/amz-markdown-sim” “text/plain”. Auto default to “text/amz-markdown-sim”.
- Returns:
The SIM-T commentId as a string.
- Raise:
SimTError if function call fails.
- get_ticket_details(ticket_id: str)[source]
Retrieves a ticket from the ticketing system.
- Parameters:
ticket_id – The ticket ID.
- Returns:
- Raise:
SimTError if function call fails.
- get_tickets(filters: dict[str, Any]) Generator[dict[str, Any], None, None][source]
Returns an iterable of ticketIds.
- Parameters:
filters
- Returns:
Returns an iterable of ticketIds.
- Raise:
SimTError if function call fails.
- invalidate_client_cache() None[source]
Clears the cached client, if caching is enabled.
This method allows manually invalidating the cached client, forcing a new client instance to be created on the next access. Useful if AWS credentials have changed or if there’s a need to connect to a different region within the same instance lifecycle.
- Returns:
None.
- Raises:
SimTError – Raises an error if caching is not enabled for this instance.