AWS code-library documentation change
Summary
Removed code examples for CreatePortal, DeletePortal, and DescribePortal API operations
Security assessment
The changes remove existing code examples but do not provide any security context or address vulnerabilities. There is no evidence of security fixes or exposure mitigation in the removed content. This appears to be routine documentation maintenance rather than security-related changes.
Diff
diff --git a/code-library/latest/ug/python_3_iotsitewise_code_examples.md b/code-library/latest/ug/python_3_iotsitewise_code_examples.md index b8f43c92b..4a0ce6e20 100644 --- a//code-library/latest/ug/python_3_iotsitewise_code_examples.md +++ b//code-library/latest/ug/python_3_iotsitewise_code_examples.md @@ -1307,74 +1306,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru -The following code example shows how to use `CreatePortal`. - -**SDK for Python (Boto3)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/iotsitewise#code-examples). - - - class IoTSitewiseWrapper: - """Encapsulates AWS IoT SiteWise actions using the client interface.""" - - def __init__(self, iotsitewise_client: client) -> None: - """ - Initializes the IoTSitewiseWrapper with an AWS IoT SiteWise client. - - :param iotsitewise_client: A Boto3 AWS IoT SiteWise client. This client provides low-level - access to AWS IoT SiteWise services. - """ - self.iotsitewise_client = iotsitewise_client - self.entry_id = 0 # Incremented to generate unique entry IDs for batch_put_asset_property_value. - - @classmethod - def from_client(cls) -> "IoTSitewiseWrapper": - """ - Creates an IoTSitewiseWrapper instance with a default AWS IoT SiteWise client. - - :return: An instance of IoTSitewiseWrapper initialized with the default AWS IoT SiteWise client. - """ - iotsitewise_client = boto3.client("iotsitewise") - return cls(iotsitewise_client) - - - def create_portal( - self, portal_name: str, iam_role_arn: str, portal_contact_email: str - ) -> str: - """ - Creates an AWS IoT SiteWise Portal. - - :param portal_name: The name of the portal to create. - :param iam_role_arn: The ARN of an IAM role. - :param portal_contact_email: The contact email of the portal. - :return: The ID of the created portal. - """ - try: - response = self.iotsitewise_client.create_portal( - portalName=portal_name, - roleArn=iam_role_arn, - portalContactEmail=portal_contact_email, - ) - portal_id = response["portalId"] - waiter = self.iotsitewise_client.get_waiter("portal_active") - waiter.wait(portalId=portal_id, WaiterConfig={"MaxAttempts": 40}) - return portal_id - except ClientError as err: - if err.response["Error"]["Code"] == "ResourceAlreadyExistsException": - logger.error("Portal %s already exists.", portal_name) - else: - logger.error( - "Error creating portal %s. Here's why %s", - portal_name, - err.response["Error"]["Message"], - ) - raise - - - - - * For API details, see [CreatePortal](https://docs.aws.amazon.com/goto/boto3/iotsitewise-2019-12-02/CreatePortal) in _AWS SDK for Python (Boto3) API Reference_. - - - - @@ -1558,61 +1483,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru -The following code example shows how to use `DeletePortal`. - -**SDK for Python (Boto3)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/iotsitewise#code-examples). - - - class IoTSitewiseWrapper: - """Encapsulates AWS IoT SiteWise actions using the client interface.""" - - def __init__(self, iotsitewise_client: client) -> None: - """ - Initializes the IoTSitewiseWrapper with an AWS IoT SiteWise client. - - :param iotsitewise_client: A Boto3 AWS IoT SiteWise client. This client provides low-level - access to AWS IoT SiteWise services. - """ - self.iotsitewise_client = iotsitewise_client - self.entry_id = 0 # Incremented to generate unique entry IDs for batch_put_asset_property_value. - - @classmethod - def from_client(cls) -> "IoTSitewiseWrapper": - """ - Creates an IoTSitewiseWrapper instance with a default AWS IoT SiteWise client. - - :return: An instance of IoTSitewiseWrapper initialized with the default AWS IoT SiteWise client. - """ - iotsitewise_client = boto3.client("iotsitewise") - return cls(iotsitewise_client) - - - def delete_portal(self, portal_id: str) -> None: - """ - Deletes an AWS IoT SiteWise Portal. - - :param portal_id: The ID of the portal to delete. - """ - try: - self.iotsitewise_client.delete_portal(portalId=portal_id) - except ClientError as err: - if err.response["Error"]["Code"] == "ResourceNotFoundException": - logger.error("Portal %s does not exist.", portal_id) - else: - logger.error( - "Error deleting portal %s. Here's why %s", - portal_id, - err.response["Error"]["Message"], - ) - raise - - - - - * For API details, see [DeletePortal](https://docs.aws.amazon.com/goto/boto3/iotsitewise-2019-12-02/DeletePortal) in _AWS SDK for Python (Boto3) API Reference_. - - - - @@ -1682,71 +1546,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru -The following code example shows how to use `DescribePortal`. - -**SDK for Python (Boto3)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/iotsitewise#code-examples). - - - class IoTSitewiseWrapper: - """Encapsulates AWS IoT SiteWise actions using the client interface.""" - - def __init__(self, iotsitewise_client: client) -> None: - """ - Initializes the IoTSitewiseWrapper with an AWS IoT SiteWise client. - - :param iotsitewise_client: A Boto3 AWS IoT SiteWise client. This client provides low-level - access to AWS IoT SiteWise services. - """ - self.iotsitewise_client = iotsitewise_client - self.entry_id = 0 # Incremented to generate unique entry IDs for batch_put_asset_property_value. - - @classmethod - def from_client(cls) -> "IoTSitewiseWrapper": - """ - Creates an IoTSitewiseWrapper instance with a default AWS IoT SiteWise client. - - :return: An instance of IoTSitewiseWrapper initialized with the default AWS IoT SiteWise client. - """ - iotsitewise_client = boto3.client("iotsitewise") - return cls(iotsitewise_client) - - - def create_gateway(self, gateway_name: str, my_thing: str) -> str: - """ - Creates an AWS IoT SiteWise Gateway. - - :param gateway_name: The name of the gateway to create. - :param my_thing: The core device thing name. - :return: The ID of the created gateway. - """ - try: - response = self.iotsitewise_client.create_gateway( - gatewayName=gateway_name, - gatewayPlatform={ - "greengrassV2": {"coreDeviceThingName": my_thing}, - }, - tags={"Environment": "Production"}, - ) - gateway_id = response["gatewayId"] - return gateway_id - except ClientError as err: - if err.response["Error"]["Code"] == "ResourceAlreadyExistsException": - logger.error("Gateway %s already exists.", gateway_name) - else: - logger.error( - "Error creating gateway %s. Here's why %s",