|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file |
| 7 | +# except in compliance with the License. A copy of the License is located at |
| 8 | +# |
| 9 | +# http://aws.amazon.com/apache2.0/ |
| 10 | +# |
| 11 | +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| 13 | +# the specific language governing permissions and limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import six |
| 19 | +import typing |
| 20 | +from enum import Enum |
| 21 | + |
| 22 | + |
| 23 | +if typing.TYPE_CHECKING: |
| 24 | + from typing import Dict, List, Optional, Union |
| 25 | + from datetime import datetime |
| 26 | + |
| 27 | + |
| 28 | +class Unit(object): |
| 29 | + """ |
| 30 | + An object that represents a logical entity for organizing actors and resources that interact with Alexa systems. |
| 31 | +
|
| 32 | +
|
| 33 | + :param unit_id: A string that represents unitId directed at skill level. Each skill gets a different directed identifier for same internal identifier. This is Skill enablement scoped identifier. This should be in format - amzn1.ask.unit.<skillDirectedId> |
| 34 | + :type unit_id: (optional) str |
| 35 | + :param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization's developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization's backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.<LWAConfuserDirectedId> |
| 36 | + :type persistent_unit_id: (optional) str |
| 37 | +
|
| 38 | + """ |
| 39 | + deserialized_types = { |
| 40 | + 'unit_id': 'str', |
| 41 | + 'persistent_unit_id': 'str' |
| 42 | + } # type: Dict |
| 43 | + |
| 44 | + attribute_map = { |
| 45 | + 'unit_id': 'unitId', |
| 46 | + 'persistent_unit_id': 'persistentUnitId' |
| 47 | + } # type: Dict |
| 48 | + supports_multiple_types = False |
| 49 | + |
| 50 | + def __init__(self, unit_id=None, persistent_unit_id=None): |
| 51 | + # type: (Optional[str], Optional[str]) -> None |
| 52 | + """An object that represents a logical entity for organizing actors and resources that interact with Alexa systems. |
| 53 | +
|
| 54 | + :param unit_id: A string that represents unitId directed at skill level. Each skill gets a different directed identifier for same internal identifier. This is Skill enablement scoped identifier. This should be in format - amzn1.ask.unit.<skillDirectedId> |
| 55 | + :type unit_id: (optional) str |
| 56 | + :param persistent_unit_id: A string that represents a unitId directed using directedIdConfuser associated with the respective Organization's developer account. This identifier is directed at an Organization level. Same identifier is shared across Organization's backend systems (which invokes API), Skills owned by the organization and authorized 3P skills. This should be in format - amzn1.alexa.unit.did.<LWAConfuserDirectedId> |
| 57 | + :type persistent_unit_id: (optional) str |
| 58 | + """ |
| 59 | + self.__discriminator_value = None # type: str |
| 60 | + |
| 61 | + self.unit_id = unit_id |
| 62 | + self.persistent_unit_id = persistent_unit_id |
| 63 | + |
| 64 | + def to_dict(self): |
| 65 | + # type: () -> Dict[str, object] |
| 66 | + """Returns the model properties as a dict""" |
| 67 | + result = {} # type: Dict |
| 68 | + |
| 69 | + for attr, _ in six.iteritems(self.deserialized_types): |
| 70 | + value = getattr(self, attr) |
| 71 | + if isinstance(value, list): |
| 72 | + result[attr] = list(map( |
| 73 | + lambda x: x.to_dict() if hasattr(x, "to_dict") else |
| 74 | + x.value if isinstance(x, Enum) else x, |
| 75 | + value |
| 76 | + )) |
| 77 | + elif isinstance(value, Enum): |
| 78 | + result[attr] = value.value |
| 79 | + elif hasattr(value, "to_dict"): |
| 80 | + result[attr] = value.to_dict() |
| 81 | + elif isinstance(value, dict): |
| 82 | + result[attr] = dict(map( |
| 83 | + lambda item: (item[0], item[1].to_dict()) |
| 84 | + if hasattr(item[1], "to_dict") else |
| 85 | + (item[0], item[1].value) |
| 86 | + if isinstance(item[1], Enum) else item, |
| 87 | + value.items() |
| 88 | + )) |
| 89 | + else: |
| 90 | + result[attr] = value |
| 91 | + |
| 92 | + return result |
| 93 | + |
| 94 | + def to_str(self): |
| 95 | + # type: () -> str |
| 96 | + """Returns the string representation of the model""" |
| 97 | + return pprint.pformat(self.to_dict()) |
| 98 | + |
| 99 | + def __repr__(self): |
| 100 | + # type: () -> str |
| 101 | + """For `print` and `pprint`""" |
| 102 | + return self.to_str() |
| 103 | + |
| 104 | + def __eq__(self, other): |
| 105 | + # type: (object) -> bool |
| 106 | + """Returns true if both objects are equal""" |
| 107 | + if not isinstance(other, Unit): |
| 108 | + return False |
| 109 | + |
| 110 | + return self.__dict__ == other.__dict__ |
| 111 | + |
| 112 | + def __ne__(self, other): |
| 113 | + # type: (object) -> bool |
| 114 | + """Returns true if both objects are not equal""" |
| 115 | + return not self == other |
0 commit comments