Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion gooddata-api-client/docs/DeclarativeParameterContent.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **str** | The parameter type. | defaults to "STRING"
**constraints** | [**StringConstraints**](StringConstraints.md) | | [optional]
**default_value** | **str** | | [optional]
**type** | **str** | The parameter type. | [optional] if omitted the server will use the default value of "STRING"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **str** | The parameter type. | defaults to "STRING"
**constraints** | [**StringConstraints**](StringConstraints.md) | | [optional]
**default_value** | **str** | | [optional]
**type** | **str** | The parameter type. | [optional] if omitted the server will use the default value of "STRING"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
2 changes: 1 addition & 1 deletion gooddata-api-client/docs/ParameterDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Parameter content (type-discriminated).
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **str** | The parameter type. | defaults to "STRING"
**constraints** | [**StringConstraints**](StringConstraints.md) | | [optional]
**default_value** | **str** | | [optional]
**type** | **str** | The parameter type. | [optional] if omitted the server will use the default value of "STRING"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,28 @@ def openapi_types():
"""
lazy_import()
return {
'type': (str,), # noqa: E501
'constraints': (StringConstraints,), # noqa: E501
'default_value': (str,), # noqa: E501
'type': (str,), # noqa: E501
}

@cached_property
def discriminator():
return None

lazy_import()
val = {
'NUMBER': NumberParameterDefinition,
'NumberParameterDefinition': NumberParameterDefinition,
'STRING': StringParameterDefinition,
'StringParameterDefinition': StringParameterDefinition,
}
if not val:
return None
return {'type': val}

attribute_map = {
'type': 'type', # noqa: E501
'constraints': 'constraints', # noqa: E501
'default_value': 'defaultValue', # noqa: E501
'type': 'type', # noqa: E501
}

read_only_vars = {
Expand All @@ -120,6 +128,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""DeclarativeParameterContent - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -152,9 +161,9 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down Expand Up @@ -226,6 +235,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
"""DeclarativeParameterContent - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -258,9 +268,9 @@ def __init__(self, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,28 @@ def openapi_types():
"""
lazy_import()
return {
'type': (str,), # noqa: E501
'constraints': (StringConstraints,), # noqa: E501
'default_value': (str,), # noqa: E501
'type': (str,), # noqa: E501
}

@cached_property
def discriminator():
return None

lazy_import()
val = {
'NUMBER': NumberParameterDefinition,
'NumberParameterDefinition': NumberParameterDefinition,
'STRING': StringParameterDefinition,
'StringParameterDefinition': StringParameterDefinition,
}
if not val:
return None
return {'type': val}

attribute_map = {
'type': 'type', # noqa: E501
'constraints': 'constraints', # noqa: E501
'default_value': 'defaultValue', # noqa: E501
'type': 'type', # noqa: E501
}

read_only_vars = {
Expand All @@ -120,6 +128,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""JsonApiParameterInAttributesDefinition - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -152,9 +161,9 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down Expand Up @@ -226,6 +235,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
"""JsonApiParameterInAttributesDefinition - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -258,9 +268,9 @@ def __init__(self, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,28 @@ def openapi_types():
"""
lazy_import()
return {
'type': (str,), # noqa: E501
'constraints': (StringConstraints,), # noqa: E501
'default_value': (str,), # noqa: E501
'type': (str,), # noqa: E501
}

@cached_property
def discriminator():
return None

lazy_import()
val = {
'NUMBER': NumberParameterDefinition,
'NumberParameterDefinition': NumberParameterDefinition,
'STRING': StringParameterDefinition,
'StringParameterDefinition': StringParameterDefinition,
}
if not val:
return None
return {'type': val}

attribute_map = {
'type': 'type', # noqa: E501
'constraints': 'constraints', # noqa: E501
'default_value': 'defaultValue', # noqa: E501
'type': 'type', # noqa: E501
}

read_only_vars = {
Expand All @@ -120,6 +128,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""ParameterDefinition - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -152,9 +161,9 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down Expand Up @@ -226,6 +235,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
"""ParameterDefinition - a model defined in OpenAPI

Keyword Args:
type (str): The parameter type.. defaults to "STRING", must be one of ["STRING", ] # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Expand Down Expand Up @@ -258,9 +268,9 @@ def __init__(self, *args, **kwargs): # noqa: E501
_visited_composed_classes = (Animal,)
constraints (StringConstraints): [optional] # noqa: E501
default_value (str): [optional] # noqa: E501
type (str): The parameter type.. [optional] if omitted the server will use the default value of "STRING" # noqa: E501
"""

type = kwargs.get('type', "STRING")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
Expand Down
1 change: 1 addition & 0 deletions packages/gooddata-sdk/src/gooddata_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
CatalogDeclarativeAnalytics,
CatalogDeclarativeMemoryItem,
CatalogDeclarativeMetric,
CatalogDeclarativeParameter,
)
from gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.export_definition import (
CatalogDeclarativeExportDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
from gooddata_api_client.model.declarative_filter_context import DeclarativeFilterContext
from gooddata_api_client.model.declarative_memory_item import DeclarativeMemoryItem
from gooddata_api_client.model.declarative_metric import DeclarativeMetric
from gooddata_api_client.model.declarative_parameter import DeclarativeParameter
from gooddata_api_client.model.declarative_visualization_object import DeclarativeVisualizationObject

from gooddata_sdk.catalog.base import Base
from gooddata_sdk.catalog.parameter import CatalogParameter
from gooddata_sdk.catalog.permission.declarative_model.permission import (
CatalogDeclarativeDashboardPermissionsForAssignee,
CatalogDeclarativeDashboardPermissionsForAssigneeRule,
Expand Down Expand Up @@ -51,6 +51,7 @@
ATTRIBUTE_HIERARCHY_OBJECTS_DIR = "attribute_hierarchy_objects"
EXPORT_DEFINITION_DIR = "export_definitions"
MEMORY_ITEMS_DIR = "memory_items"
PARAMETERS_DIR = "parameters"


@define(kw_only=True)
Expand Down Expand Up @@ -82,7 +83,7 @@ class CatalogDeclarativeAnalyticsLayer(Base):
visualization_objects: list[CatalogDeclarativeVisualizationObject] = field(factory=list)
export_definitions: list[CatalogDeclarativeExportDefinition] = field(factory=list)
memory_items: list[CatalogDeclarativeMemoryItem] = field(factory=list)
parameters: list[CatalogParameter] = field(factory=list)
parameters: list[CatalogDeclarativeParameter] = field(factory=list)

@staticmethod
def client_class() -> type[DeclarativeAnalyticsLayer]:
Expand Down Expand Up @@ -148,6 +149,12 @@ def get_memory_item_folder(analytics_model_folder: Path) -> Path:
create_directory(folder)
return folder

@staticmethod
def get_parameters_folder(analytics_model_folder: Path) -> Path:
folder = analytics_model_folder / PARAMETERS_DIR
create_directory(folder)
return folder

def store_to_disk(self, workspace_folder: Path, sort: bool = False) -> None:
analytics_model_folder = self.get_analytics_model_folder(workspace_folder)

Expand All @@ -160,6 +167,7 @@ def store_to_disk(self, workspace_folder: Path, sort: bool = False) -> None:
attribute_hierarchy_folder = self.get_attribute_hierarchy_folder(analytics_model_folder)
export_definition_folder = self.get_export_definition_folder(analytical_dashboards_folder)
memory_item_folder = self.get_memory_item_folder(analytics_model_folder)
parameters_folder = self.get_parameters_folder(analytics_model_folder)

for analytical_dashboard in self.analytical_dashboards:
analytical_dashboard.store_to_disk(analytical_dashboards_folder, sort=sort)
Expand Down Expand Up @@ -188,6 +196,9 @@ def store_to_disk(self, workspace_folder: Path, sort: bool = False) -> None:
for memory_item in self.memory_items:
memory_item.store_to_disk(memory_item_folder, sort=sort)

for parameter in self.parameters:
parameter.store_to_disk(parameters_folder, sort=sort)

@classmethod
def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLayer:
analytics_model_folder = cls.get_analytics_model_folder(workspace_folder)
Expand All @@ -200,6 +211,7 @@ def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLa
attribute_hierarchy_folder = cls.get_attribute_hierarchy_folder(analytics_model_folder)
export_definition_folder = cls.get_export_definition_folder(analytical_dashboards_folder)
memory_item_folder = cls.get_memory_item_folder(analytics_model_folder)
parameters_folder = cls.get_parameters_folder(analytics_model_folder)

analytical_dashboard_files = get_sorted_yaml_files(analytical_dashboards_folder)
analytical_dashboard_extension_files = get_sorted_yaml_files(analytical_dashboard_extensions_folder)
Expand All @@ -210,6 +222,7 @@ def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLa
attribute_hierarchy_files = get_sorted_yaml_files(attribute_hierarchy_folder)
export_definition_files = get_sorted_yaml_files(export_definition_folder)
memory_item_files = get_sorted_yaml_files(memory_item_folder)
parameter_files = get_sorted_yaml_files(parameters_folder)

analytical_dashboards = [
CatalogDeclarativeAnalyticalDashboard.load_from_disk(analytical_dashboard_file)
Expand Down Expand Up @@ -243,6 +256,7 @@ def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLa
memory_items = [
CatalogDeclarativeMemoryItem.load_from_disk(memory_item_file) for memory_item_file in memory_item_files
]
parameters = [CatalogDeclarativeParameter.load_from_disk(parameter_file) for parameter_file in parameter_files]
return cls(
analytical_dashboards=analytical_dashboards,
analytical_dashboard_extensions=analytical_dashboard_extensions,
Expand All @@ -253,6 +267,7 @@ def load_from_disk(cls, workspace_folder: Path) -> CatalogDeclarativeAnalyticsLa
visualization_objects=visualization_objects,
export_definitions=export_definitions,
memory_items=memory_items,
parameters=parameters,
)


Expand Down Expand Up @@ -348,3 +363,10 @@ class CatalogDeclarativeMemoryItem(CatalogAnalyticsBaseMeta):
@staticmethod
def client_class() -> type[DeclarativeMemoryItem]:
return DeclarativeMemoryItem


@define(kw_only=True)
class CatalogDeclarativeParameter(CatalogAnalyticsBase):
@staticmethod
def client_class() -> type[DeclarativeParameter]:
return DeclarativeParameter
Loading
Loading