Common
A collection of methods that make interaction with coreDB more straight-forward.
This prevents someone from having to re-write database statements many times, that might turn out to be erroneous or inconsistent when not careful. These methods relate to operations on subscriptions.
get_product_id_by_name(product_name)
Retrieve the UUID of a product by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_name
|
ProductName
|
The name of the product. |
required |
Returns:
| Type | Description |
|---|---|
UUID
|
The UUID of the product. |
Source code in gso/services/subscriptions/common.py
get_subscriptions(*, product_types=None, lifecycles=None, includes=None, excludes=None, partner_id=None, subscription_ids=None, exclude_subscription_ids=None, subscription_filters=None, instance_filters=None)
Retrieve active subscriptions for a specific product type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product_types
|
list[ProductType] | None
|
The types of the product for which to retrieve subscriptions. |
None
|
lifecycles
|
list[SubscriptionLifecycle] | None
|
The lifecycles that the products must be in. |
None
|
includes
|
list[str] | None
|
List of fields to be included in the returned Subscription objects. |
None
|
excludes
|
list[str] | None
|
List of fields to be excluded from the returned Subscription objects. |
None
|
partner_id
|
UUIDstr | None
|
The customer id of subscriptions. |
None
|
subscription_ids
|
list[UUIDstr] | None
|
A list of specific subscription IDs to filter by. |
None
|
exclude_subscription_ids
|
list[UUIDstr] | None
|
A list of subscription IDs to exclude from the results. |
None
|
subscription_filters
|
list[dict[str, str]] | None
|
A list of single-entry dicts where each key is a SubscriptionTable column name, e.g. [{"status": "ACTIVE"}]. |
None
|
instance_filters
|
list[dict[str, str]] | None
|
A list of single-entry dicts where each key is a resource-type (in SubscriptionInstanceValueTable), e.g. [{"edge_port_name": "ae11"}]. TODO: We can add nested filters here in the future, e.g. [{"node__router_fqdn": "router.example.com"}]. |
None
|
Returns:
| Type | Description |
|---|---|
list[SubscriptionType]
|
A list of |
Source code in gso/services/subscriptions/common.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |