MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / __init__

Method __init__

scripts/agents/devops/src/aws/base.py:110–162  ·  view source on GitHub ↗

Initialize the AWS service. Args: credentials: AWSCredentials object. If None, credentials will be loaded from the credential manager. region: AWS region name. If None, will use the region from credentials o

(
        self,
        credentials: Optional[AWSCredentials] = None,
        region: Optional[str] = None,
        profile_name: Optional[str] = None,
        endpoint_url: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

108 }
109
110 def __init__(
111 self,
112 credentials: Optional[AWSCredentials] = None,
113 region: Optional[str] = None,
114 profile_name: Optional[str] = None,
115 endpoint_url: Optional[str] = None
116 ):
117 """
118 Initialize the AWS service.
119
120 Args:
121 credentials: AWSCredentials object. If None, credentials will be loaded
122 from the credential manager.
123 region: AWS region name. If None, will use the region from credentials
124 or the AWS_REGION environment variable.
125 profile_name: AWS profile name from ~/.aws/credentials. Used only if
126 credentials are not provided.
127 endpoint_url: Custom endpoint URL for the service.
128
129 Raises:
130 AWSServiceError: If the service name is not set or credentials are invalid.
131 """
132 if not self.SERVICE_NAME:
133 raise AWSServiceError(
134 "Service name must be set by subclasses (set SERVICE_NAME class attribute)"
135 )
136
137 self.region = region
138 self.endpoint_url = endpoint_url
139
140 # Set up credentials
141 if credentials:
142 self.credentials = credentials
143 else:
144 cred_manager = get_credential_manager()
145 self.credentials = cred_manager.get_aws_credentials(
146 profile_name=profile_name,
147 region=region
148 )
149
150 # Region can come from credentials if not explicitly provided
151 if not self.region:
152 self.region = self.credentials.region
153
154 # Initialize session and clients
155 self.session = self.credentials.get_session()
156 self._init_clients()
157
158 # Load service-specific configuration
159 self.config = get_config()
160
161 # Verify access by making a simple API call
162 self._verify_access()
163
164 def _init_clients(self) -> None:
165 """Initialize service client and resource objects."""

Callers

nothing calls this directly

Calls 6

_init_clientsMethod · 0.95
_verify_accessMethod · 0.95
get_credential_managerFunction · 0.85
get_configFunction · 0.85
AWSServiceErrorClass · 0.70
get_aws_credentialsMethod · 0.45

Tested by

no test coverage detected