AWS Provider¶
Provide the classes to associate a VHD image into a product on AWS Marketplace.
Note
Uses Boto3 to access AWS Marketplace public API.
Index:
Providers¶
- class cloudpub.aws.AWSVersionMetadata(version_mapping, marketplace_entity_type, **kwargs)[source]¶
A collection of metadata necessary for publishing a AMI into a product.
- __init__(version_mapping, marketplace_entity_type, **kwargs)[source]¶
Create a new AWS Version Metadata object.
- Parameters:
version_mapping (VersionMapping) – A mapping of all the information to add a new version
marketplace_entity_type (str) – Product type of the AWS product Example: AmiProduct
- class cloudpub.aws.AWSProductService(access_id, secret_key, region='us-east-1', attempts=288, interval=600)[source]¶
Create a new service provider for AWS using Boto3.
- __init__(access_id, secret_key, region='us-east-1', attempts=288, interval=600)[source]¶
AWS cloud provider service.
- Parameters:
access_id (str) – AWS account access ID
secret_key (str) – AWS account secret access key
region (str, optional) – AWS region for compute operations This defaults to ‘us-east-1’
attempts (int, optional) – Max number of times to poll while waiting for changeset Defaults to 288
interval (int, optional) – Seconds between polling while waiting for changeset Defaults to 600
- get_product_by_id(entity_id)[source]¶
Get a product detail by it’s id.
- Parameters:
entity_id (str) – Entity id to get details from. If not set will default to class setting for EntityId.
- Returns:
The details for a product
- Return type:
- Raises:
NotFoundError when the product is not found. –
- get_product_by_name(marketplace_entity_type, product_name)[source]¶
Get a product detail by it’s name.
- Parameters:
- Returns:
A dict of details for the first response of a product
- Return type:
- Raises:
NotFoundError when the product is not found. –
InvalidStateError when more than one product is found. –
- get_product_version_by_name(entity_id, version_name)[source]¶
Get a version detail by it’s name.
- Parameters:
- Returns:
The delivery options of a version
- Return type:
- Raises:
NotFoundError when the product is not found. –
- get_product_version_details(entity_id, version_id)[source]¶
Get a product detail by it’s name.
- Parameters:
- Returns:
The details for the first response of a product
- Return type:
- Raises:
NotFoundError when the product is not found. –
- get_product_versions(entity_id)[source]¶
Get the titles, ids, and date created of all the versions of a product.
- Parameters:
entity_id (str) – The Id of the entity to get versions from
- Returns:
A dictionary of versions
- Return type:
Dict[str, GroupedVersions]
- Raises:
NotFoundError when the product is not found. –
- publish(metadata)[source]¶
Add new version to an existing product.
- Parameters:
new_version_details (VersionMapping) – A model of the version mapping
- Return type:
- restrict_versions(entity_id, marketplace_entity_type, restrict_major=None, restrict_minor=1)[source]¶
Restrict the old versions of a release.
- Parameters:
- Returns:
List of AMI ids of restricted versions
- Return type:
List[str]
- set_restrict_versions(entity_id, marketplace_entity_type, delivery_option_ids)[source]¶
Restrict version(s) of a product by their id.
AWS Models¶
The models used by AWSProductService
.
The models are defined with attrs using the class AttrsJSONDecodeMixin
to
serialize/deserialize the JSON values for each request.
Note
This interacts with start_change_set in Boto3’s AWS Marketplace implementation.
Contents:
AWS Version Mapping¶
- class cloudpub.models.aws.VersionMapping(version, delivery_options)[source]¶
Represent the version mapping information.
Attributes:
-
delivery_options:
List
[DeliveryOption
]¶ Delivery Options object.
-
delivery_options:
- class cloudpub.models.aws.DeliveryOption(id, type, source_id, short_description, long_description, instructions, recommendations, visibility, details, title, ami_alias)[source]¶
Represent the delivery option information.
Attributes:
-
details:
DeliveryOptionsDetails
¶ Details object for Delivery Options
-
instructions:
DeliveryOptionsInstructions
¶ Instructions on usage of this AMI
-
recommendations:
DeliveryOptionsRecommendations
¶ Recommendations when using this AMI
- class cloudpub.models.aws.DeliveryOptionsRecommendations(instance_type, security_groups)[source]¶
Represent a single element of recommendations from class
DeliveryOption
.Attributes:
- class cloudpub.models.aws.DeliveryOptionsInstructions(usage, access)[source]¶
Represent a single element of instructions from class
DeliveryOption
.Attributes:
-
access:
Optional
[DeliveryInstructionsAccess
]¶ Instructions on how to access this AMI
-
access:
- class cloudpub.models.aws.DeliveryInstructionsAccess(type, port, protocol)[source]¶
Represent a single element of access from class
DeliveryOptionsInstructions
.Attributes:
- class cloudpub.models.aws.DeliveryOptionsDetails(ami_delivery_options_details)[source]¶
Represent the ami delivery options information.
Attributes:
-
ami_delivery_options_details:
AmiDeliveryOptionsDetails
¶ Ami Delivery Options details
-
ami_delivery_options_details:
- class cloudpub.models.aws.AmiDeliveryOptionsDetails(ami_source, usage_instructions, recommended_instance_type, security_groups, access_endpoint_url)[source]¶
Represent the delivery options details information.
Attributes:
-
access_endpoint_url:
AccessEndpointUrl
¶ Access endpoint url object
-
security_groups:
List
[SecurityGroup
]¶ Security group object
- class cloudpub.models.aws.SecurityGroup(from_port, ip_protocol, ip_ranges, to_port)[source]¶
Represent the security group information.
Attributes:
- class cloudpub.models.aws.AccessEndpointUrl(port, protocol)[source]¶
Represent the access endpoint url information.
Attributes:
- class cloudpub.models.aws.Version(version_title, release_notes)[source]¶
Represent the version information.
Attributes:
- class cloudpub.models.aws.AMISource(ami_id, access_role_arn, username, operating_system_name, operating_system_version, scanning_port)[source]¶
Represent the Ami Source information.
Attributes:
Product Resources¶
- class cloudpub.models.aws.ProductDetailDescription(replacement_product_id, highlights, product_code, search_keywords, product_title, short_description, long_description, manufacturer, product_state, visibility, associated_products, sku, categories)[source]¶
Represent the “Details” section of the
ProductDetailResponse
.Attributes:
search_keywords()
- class cloudpub.models.aws.ProductVersionsResponse(version_id, release_notes, upgrade_instructions, version_title, creation_date, sources, delivery_options)[source]¶
Represent the “Versions” section of the
ProductDetailResponse
.Attributes:
-
delivery_options:
List
[DeliveryOption
]¶ The delivery options for the current version.
-
sources:
List
[Union
[ProductVersionsVirtualizationSource
,ProductVersionsCloudFormationSource
]]¶ The linked sources for the current version.
- class cloudpub.models.aws.PromotionalResources(promotional_media, logo_url, additional_resources, videos)[source]¶
Represent the “PromotionalResources” section of the
ProductDetailResponse
.Attributes:
-
additional_resources:
List
[AdditionalResources
]¶ The product’s additional resources.
-
videos:
List
[PromoResourcesVideo
]¶ The promotional/demonstration videos about the product.
-
additional_resources:
- class cloudpub.models.aws.Dimensions(types, description, unit, key, name)[source]¶
Represent a single element of dimensions from
ProductDetailResponse
.Attributes:
- class cloudpub.models.aws.SupportInformation(description, resources)[source]¶
Represent the support_information attribute of
ProductDetailResponse
.Attributes:
- class cloudpub.models.aws.RegionAvailability(restrict, regions, future_region_support)[source]¶
Represent the region_availability attribute of
ProductDetailResponse
.Attributes:
- class cloudpub.models.aws.TargetingDetail(positive_targeting)[source]¶
Represent the targeting attribute of
ProductDetailResponse
.Attributes:
-
positive_targeting:
PositiveTargeting
¶ The positive targeting object for the
TargetingDetail
.
-
positive_targeting:
- class cloudpub.models.aws.ProductDetailResponse(versions, description, promotional_resources, dimensions, support_information, region_availability, targeting, compatibility)[source]¶
Represent the parsed elements from “Details” of
DescribeEntityResponse
.Attributes:
-
compatibility:
Optional
[SourcesCompatibility
]¶ The product’s compatibility.
-
description:
ProductDetailDescription
¶ The product’s description.
-
dimensions:
List
[Dimensions
]¶ The product’s dimensions.
-
promotional_resources:
PromotionalResources
¶ The product’s promotional resources.
-
region_availability:
RegionAvailability
¶ The product’s availability on AWS regions.
-
support_information:
SupportInformation
¶ The product’s support information.
-
targeting:
TargetingDetail
¶ The product’s targeting.
-
versions:
List
[ProductVersionsResponse
]¶ The product’s versions list.
- class cloudpub.models.aws.DescribeEntityResponse(type, identifier, arn, last_modified_date, details, details_document, meta)[source]¶
Represent the response of
MarketplaceCatalog.Client.describe_entity
.Attributes:
-
details_document:
ProductDetailResponse
¶ This json object of the details of the entity.
-
last_modified_date:
str
¶ 22Z).
- Type:
The last modified date of the entity, in ISO 8601 format (2018-02-27T13
- Type:
45
-
meta:
ResponseMetadata
¶ The describe_entity response’s metadata.
-
details_document:
- class cloudpub.models.aws.EntitySummary(name, entity_type, entity_id, entity_arn, last_modified_date, visibility)[source]¶
Represent a single element of attribute “entity_summary_list” of
ListEntitiesResponse
.Attributes:
- class cloudpub.models.aws.ListEntitiesResponse(entity_summary_list, next_token)[source]¶
Represent the response of
MarketplaceCatalog.Client.list_entities
.Attributes:
-
entity_summary_list:
List
[EntitySummary
]¶ Array of EntitySummary objects.
-
entity_summary_list:
Resources internal elements¶
- class cloudpub.models.aws.BaseEntity(type, identifier)[source]¶
Represent an in change entity on AWS.
Attributes:
- class cloudpub.models.aws.OperatingSystem(name, version, username, scanning_port)[source]¶
Represent the operating_system attribute of
ProductVersionsVirtualizationSource
.Attributes:
- class cloudpub.models.aws.ProductVersionsBase(source_id, type)[source]¶
The base definition for product versions.
Attributes:
- class cloudpub.models.aws.ProductVersionsCloudFormationSource(source_id, type, nested_documents, consumed_sources, aws_dependent_services, architecture_diagram, template)[source]¶
Represent one of the supported source types from
ProductVersionsResponse
.Attributes:
source_id()
[inherited]type()
[inherited]
- class cloudpub.models.aws.ProductVersionsVirtualizationSource(source_id, type, image, architecture, virtualization_type, operating_system, compatibility)[source]¶
Represent one of the supported source types from
ProductVersionsResponse
.Attributes:
source_id()
[inherited]type()
[inherited]
-
compatibility:
SourcesCompatibility
¶ The source compatibilities for the current version.
-
operating_system:
OperatingSystem
¶ The operating system for the current version.
- class cloudpub.models.aws.SourcesCompatibility(available_instance_types, restricted_instance_types)[source]¶
Represent the compatibility attribute of
ProductVersionsVirtualizationSource
.Attributes:
- class cloudpub.models.aws.BaseResources(type, url)[source]¶
Common base class for extra resources.
Child classes:
Attributes:
- class cloudpub.models.aws.AdditionalResources(type, url, text)[source]¶
Represent a single element of additional_resources from class
PromotionalResources
.Attributes:
type()
[inherited]url()
[inherited]
- class cloudpub.models.aws.PromoResourcesVideo(type, url, title)[source]¶
Represent a single element of videos from class
PromotionalResources
.Attributes:
type()
[inherited]url()
[inherited]
- class cloudpub.models.aws.PositiveTargeting(buyer_accounts)[source]¶
Represent the positive_targeting attribute of
TargetingDetail
.Attributes:
- class cloudpub.models.aws.ResponseMetadata(request_id, status_code, http_headers, retry_attemps)[source]¶
Represent the describe_entity HTTPS response metadata.
It’s part of
DescribeEntityResponse
.Attributes:
retry_attemps()
-
http_headers:
Dict
[str
,str
]¶ The HTTP readers returned in the response.
Fields:
date
: The HTTP response date (e.g.: “Fri, 25 Aug 2023 20:50:06 GMT”)content-type
: The HTTP content type (e.g: “application/json”)
#
content-length
: The HTTP body length (e.g.: “3029”) #connection
: The HTTP connection definition (e.g.: “keep-alive”) #x-amzn-requestid
: The UUID of the request ID to AWS.
- class cloudpub.models.aws.ChangeSummary(change_type, entity, details, error_details, name)[source]¶
Represent a single element of the “change_set” attribute of
DescribeChangeSetReponse
.Attributes:
-
entity:
BaseEntity
¶ The entity to be changed.
-
error_details:
List
[ErrorDetail
]¶ An array of
ErrorDetail
objects associated with the change.
-
entity:
- class cloudpub.models.aws.DescribeChangeSetReponse(id, arn, name, start_time, end_time, status, failure_code, failure_description, change_set)[source]¶
Represent the response of
MarketplaceCatalog.Client.describe_change_set
.Attributes:
name()
-
arn:
str
¶ The ARN associated with the unique identifier for the change set referenced in this request.
-
change_set:
List
[ChangeSummary
]¶ An array of ChangeSummary objects.
-
end_time:
Optional
[str
]¶ 22Z) the request transitioned to a terminal state.
The change cannot transition to a different state. Null if the request is not in a terminal state.
- Type:
The date and time, in ISO 8601 format (2018-02-27T13
- Type:
45
-
failure_code:
Optional
[str
]¶ Returned if the change set is in
FAILED
status.Can be either
CLIENT_ERROR
, which means that there are issues with the request (see theErrorDetailList
), orSERVER_FAULT
, which means that there is a problem in the system, and you should retry your request.
-
failure_description:
Optional
[str
]¶ Returned if there is a failure on the change set, but that failure is not related to any of the changes in the request.
- class cloudpub.models.aws.ErrorDetail(code, message)[source]¶
Represent the details of a single error.
Attributes:
- class cloudpub.models.aws.ChangeSetResponse[source]¶
Represent the response of
MarketplaceCatalog.Client.start_change_set
orMarketplaceCatalog.Client.cancel_change_set
.
- class cloudpub.models.aws.GroupedVersions[source]¶
Represent a simplified data for versions with fewer information.
-
delivery_options:
List
[DeliveryOption
]¶ List of
DeliveryOption
objects of a specific version.
-
delivery_options: