Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ServiceCatalog #6672

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
69ef17d
Initial work for ServiceCatalog support.
davidconnor-ont Aug 8, 2023
f45022e
Futher refinement of object types.
davidconnor-ont Aug 9, 2023
fb07ca2
Added additional endpoints and refactored tests to reuse instantiatio…
davidconnor-ont Aug 10, 2023
3bc7bad
Hooked up more happy path endpoints and tests
davidconnor-ont Aug 10, 2023
6d5587d
Added outputs of cloud formation to provisioned product
davidconnor-ont Aug 10, 2023
2654d50
Search product by name or id
davidconnor-ont Aug 11, 2023
8341ea7
Terminate product instance stub included
davidconnor-ont Aug 11, 2023
69e8f5c
Initial exception handling
davidconnor-ont Aug 14, 2023
d62aaa2
Added additional endpoints to support terraform testing
davidconnor-ont Aug 15, 2023
60608fc
Merged upstream master
davidconnor-ont Aug 15, 2023
ad6ac3c
Implementation coverage output for servicecatalog endpoints
davidconnor-ont Aug 15, 2023
2b5a183
Cleanup of subset of tests including ARN generation
davidconnor-ont Aug 16, 2023
50a669f
Added filters to search-provisioned-product and describe-record
davidconnor-ont Aug 16, 2023
5fa6128
Added initial filter to search-product
davidconnor-ont Aug 16, 2023
3458c0a
Added test stubs for the remaining tests to implement for initial cov…
davidconnor-ont Aug 17, 2023
e9a7990
Made filtering match some of the behaviour on AWS
davidconnor-ont Aug 22, 2023
00eaa6f
Added more tests covering resources not found
davidconnor-ont Aug 22, 2023
d6bc350
Added no product found test for list_portfolios
davidconnor-ont Aug 22, 2023
3c7a37e
Added sorting to endpoints that use sorting and added output_key filt…
davidconnor-ont Aug 22, 2023
07979bf
Refactored tests to share data where possible
davidconnor-ont Aug 23, 2023
745e223
Improved tagging and filtering
davidconnor-ont Aug 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 97 additions & 1 deletion IMPLEMENTATION_COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6488,6 +6488,102 @@
- [ ] untag_resource
</details>

## servicecatalog
<details>
<summary>21% implemented</summary>

- [ ] accept_portfolio_share
- [ ] associate_budget_with_resource
- [ ] associate_principal_with_portfolio
- [X] associate_product_with_portfolio
- [ ] associate_service_action_with_provisioning_artifact
- [ ] associate_tag_option_with_resource
- [ ] batch_associate_service_action_with_provisioning_artifact
- [ ] batch_disassociate_service_action_from_provisioning_artifact
- [ ] copy_product
- [X] create_constraint
- [X] create_portfolio
- [ ] create_portfolio_share
- [X] create_product
- [ ] create_provisioned_product_plan
- [ ] create_provisioning_artifact
- [ ] create_service_action
- [ ] create_tag_option
- [ ] delete_constraint
- [ ] delete_portfolio
- [ ] delete_portfolio_share
- [ ] delete_product
- [ ] delete_provisioned_product_plan
- [ ] delete_provisioning_artifact
- [ ] delete_service_action
- [ ] delete_tag_option
- [ ] describe_constraint
- [ ] describe_copy_product_status
- [X] describe_portfolio
- [ ] describe_portfolio_share_status
- [ ] describe_portfolio_shares
- [X] describe_product
- [X] describe_product_as_admin
- [ ] describe_product_view
- [X] describe_provisioned_product
- [ ] describe_provisioned_product_plan
- [ ] describe_provisioning_artifact
- [ ] describe_provisioning_parameters
- [ ] describe_record
- [ ] describe_service_action
- [ ] describe_service_action_execution_parameters
- [ ] describe_tag_option
- [ ] disable_aws_organizations_access
- [ ] disassociate_budget_from_resource
- [ ] disassociate_principal_from_portfolio
- [ ] disassociate_product_from_portfolio
- [ ] disassociate_service_action_from_provisioning_artifact
- [ ] disassociate_tag_option_from_resource
- [ ] enable_aws_organizations_access
- [ ] execute_provisioned_product_plan
- [ ] execute_provisioned_product_service_action
- [ ] get_aws_organizations_access_status
- [X] get_provisioned_product_outputs
- [ ] import_as_provisioned_product
- [ ] list_accepted_portfolio_shares
- [ ] list_budgets_for_resource
- [ ] list_constraints_for_portfolio
- [X] list_launch_paths
- [ ] list_organization_portfolio_access
- [ ] list_portfolio_access
- [X] list_portfolios
- [X] list_portfolios_for_product
- [ ] list_principals_for_portfolio
- [ ] list_provisioned_product_plans
- [X] list_provisioning_artifacts
- [ ] list_provisioning_artifacts_for_service_action
- [ ] list_record_history
- [ ] list_resources_for_tag_option
- [ ] list_service_actions
- [ ] list_service_actions_for_provisioning_artifact
- [ ] list_stack_instances_for_provisioned_product
- [ ] list_tag_options
- [ ] notify_provision_product_engine_workflow_result
- [ ] notify_terminate_provisioned_product_engine_workflow_result
- [ ] notify_update_provisioned_product_engine_workflow_result
- [X] provision_product
- [ ] reject_portfolio_share
- [ ] scan_provisioned_products
- [X] search_products
- [ ] search_products_as_admin
- [X] search_provisioned_products
- [X] terminate_provisioned_product
- [ ] update_constraint
- [X] update_portfolio
- [ ] update_portfolio_share
- [X] update_product
- [ ] update_provisioned_product
- [ ] update_provisioned_product_properties
- [ ] update_provisioning_artifact
- [ ] update_service_action
- [ ] update_tag_option
</details>

## servicediscovery
<details>
<summary>61% implemented</summary>
Expand Down Expand Up @@ -7486,4 +7582,4 @@
- workspaces
- workspaces-web
- xray
</details>
</details>
120 changes: 120 additions & 0 deletions docs/docs/services/servicecatalog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.. _implementedservice_servicecatalog:

.. |start-h3| raw:: html

<h3>

.. |end-h3| raw:: html

</h3>

==============
servicecatalog
==============

.. autoclass:: moto.servicecatalog.models.ServiceCatalogBackend

|start-h3| Example usage |end-h3|

.. sourcecode:: python

@mock_servicecatalog
def test_servicecatalog_behaviour:
boto3.client("servicecatalog")
...



|start-h3| Implemented features for this service |end-h3|

- [ ] accept_portfolio_share
- [ ] associate_budget_with_resource
- [ ] associate_principal_with_portfolio
- [X] associate_product_with_portfolio
- [ ] associate_service_action_with_provisioning_artifact
- [ ] associate_tag_option_with_resource
- [ ] batch_associate_service_action_with_provisioning_artifact
- [ ] batch_disassociate_service_action_from_provisioning_artifact
- [ ] copy_product
- [X] create_constraint
- [X] create_portfolio
- [ ] create_portfolio_share
- [X] create_product
- [ ] create_provisioned_product_plan
- [ ] create_provisioning_artifact
- [ ] create_service_action
- [ ] create_tag_option
- [ ] delete_constraint
- [ ] delete_portfolio
- [ ] delete_portfolio_share
- [ ] delete_product
- [ ] delete_provisioned_product_plan
- [ ] delete_provisioning_artifact
- [ ] delete_service_action
- [ ] delete_tag_option
- [ ] describe_constraint
- [ ] describe_copy_product_status
- [X] describe_portfolio
- [ ] describe_portfolio_share_status
- [ ] describe_portfolio_shares
- [X] describe_product
- [X] describe_product_as_admin
- [ ] describe_product_view
- [X] describe_provisioned_product
- [ ] describe_provisioned_product_plan
- [ ] describe_provisioning_artifact
- [ ] describe_provisioning_parameters
- [ ] describe_record
- [ ] describe_service_action
- [ ] describe_service_action_execution_parameters
- [ ] describe_tag_option
- [ ] disable_aws_organizations_access
- [ ] disassociate_budget_from_resource
- [ ] disassociate_principal_from_portfolio
- [ ] disassociate_product_from_portfolio
- [ ] disassociate_service_action_from_provisioning_artifact
- [ ] disassociate_tag_option_from_resource
- [ ] enable_aws_organizations_access
- [ ] execute_provisioned_product_plan
- [ ] execute_provisioned_product_service_action
- [ ] get_aws_organizations_access_status
- [X] get_provisioned_product_outputs
- [ ] import_as_provisioned_product
- [ ] list_accepted_portfolio_shares
- [ ] list_budgets_for_resource
- [ ] list_constraints_for_portfolio
- [X] list_launch_paths
- [ ] list_organization_portfolio_access
- [ ] list_portfolio_access
- [X] list_portfolios
- [X] list_portfolios_for_product
- [ ] list_principals_for_portfolio
- [ ] list_provisioned_product_plans
- [X] list_provisioning_artifacts
- [ ] list_provisioning_artifacts_for_service_action
- [ ] list_record_history
- [ ] list_resources_for_tag_option
- [ ] list_service_actions
- [ ] list_service_actions_for_provisioning_artifact
- [ ] list_stack_instances_for_provisioned_product
- [ ] list_tag_options
- [ ] notify_provision_product_engine_workflow_result
- [ ] notify_terminate_provisioned_product_engine_workflow_result
- [ ] notify_update_provisioned_product_engine_workflow_result
- [X] provision_product
- [ ] reject_portfolio_share
- [ ] scan_provisioned_products
- [X] search_products
- [ ] search_products_as_admin
- [X] search_provisioned_products
- [X] terminate_provisioned_product
- [ ] update_constraint
- [X] update_portfolio
- [ ] update_portfolio_share
- [X] update_product
- [ ] update_provisioned_product
- [ ] update_provisioned_product_properties
- [ ] update_provisioning_artifact
- [ ] update_service_action
- [ ] update_tag_option

3 changes: 3 additions & 0 deletions moto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def f(*args: Any, **kwargs: Any) -> Any:
mock_xray_client = lazy_load(".xray", "mock_xray_client")
mock_wafv2 = lazy_load(".wafv2", "mock_wafv2")
mock_textract = lazy_load(".textract", "mock_textract")
mock_servicecatalog = lazy_load(
".servicecatalog", "mock_servicecatalog", boto3_name="servicecatalog"
)


class MockAll(ContextDecorator):
Expand Down
1 change: 1 addition & 0 deletions moto/backend_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
("scheduler", re.compile("https?://scheduler\\.(.+)\\.amazonaws\\.com")),
("sdb", re.compile("https?://sdb\\.(.+)\\.amazonaws\\.com")),
("secretsmanager", re.compile("https?://secretsmanager\\.(.+)\\.amazonaws\\.com")),
("servicecatalog", re.compile("https?://servicecatalog\\.(.+)\\.amazonaws\\.com")),
(
"servicediscovery",
re.compile("https?://servicediscovery\\.(.+)\\.amazonaws\\.com"),
Expand Down
5 changes: 5 additions & 0 deletions moto/servicecatalog/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""servicecatalog module initialization; sets value for base decorator."""
from .models import servicecatalog_backends
from ..core.models import base_decorator

mock_servicecatalog = base_decorator(servicecatalog_backends)
50 changes: 50 additions & 0 deletions moto/servicecatalog/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Exceptions raised by the servicecatalog service."""
from moto.core.exceptions import JsonRESTError
import json


class ServiceCatalogClientError(JsonRESTError):
code = 400


class ResourceNotFoundException(ServiceCatalogClientError):
code = 404

def __init__(self, message: str, resource_id: str, resource_type: str):
super().__init__("ResourceNotFoundException", message)
self.description = json.dumps(
{
"resourceId": resource_id,
"message": self.message,
"resourceType": resource_type,
}
)


class ProductNotFound(ResourceNotFoundException):
code = 404

def __init__(self, product_id: str):
super().__init__(
"Product not found",
resource_id=product_id,
resource_type="AWS::ServiceCatalog::Product",
)


class PortfolioNotFound(ResourceNotFoundException):
code = 404

def __init__(self, identifier: str, identifier_name: str):
super().__init__(
"Portfolio not found",
resource_id=f"{identifier_name}={identifier}",
resource_type="AWS::ServiceCatalog::Portfolio",
)


class InvalidParametersException(ServiceCatalogClientError):
code = 400

def __init__(self, message: str):
super().__init__("InvalidParametersException", message)
Loading