id
int64
0
843k
repository_name
stringlengths
7
55
file_path
stringlengths
9
332
class_name
stringlengths
3
290
human_written_code
stringlengths
12
4.36M
class_skeleton
stringlengths
19
2.2M
total_program_units
int64
1
9.57k
total_doc_str
int64
0
4.2k
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
300
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
176
CountClassBase
float64
0
48
CountClassCoupled
float64
0
589
CountClassCoupledModified
float64
0
581
CountClassDerived
float64
0
5.37k
CountDeclInstanceMethod
float64
0
4.2k
CountDeclInstanceVariable
float64
0
299
CountDeclMethod
float64
0
4.2k
CountDeclMethodAll
float64
0
4.2k
CountLine
float64
1
115k
CountLineBlank
float64
0
9.01k
CountLineCode
float64
0
94.4k
CountLineCodeDecl
float64
0
46.1k
CountLineCodeExe
float64
0
91.3k
CountLineComment
float64
0
27k
CountStmt
float64
1
93.2k
CountStmtDecl
float64
0
46.1k
CountStmtExe
float64
0
90.2k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
6k
2,300
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/channels/resource_values.py
mbed_cloud.subscribe.channels.resource_values.PreSubscriptionRegistry
class PreSubscriptionRegistry(object): """A registry representing the presubscription JSON array of objects""" def __init__(self, api): """New registry instance""" self.api = api self.current = [] def load_from_cloud(self): """Sync - read""" self.current = [ {k: v for k, v in p.to_dict().items() if v is not None} for p in self.api.list_presubscriptions() ] def save_to_cloud(self): """Sync - write""" self.api.update_presubscriptions(self.current) def add(self, items): """Add entry to global presubs list""" with _presub_lock: self.load_from_cloud() for entry in utils.ensure_listable(items): # add new entries, but only if they're unique if entry not in self.current: self.current.append(entry) self.save_to_cloud() def remove(self, items): """Remove entry from global presubs list""" with _presub_lock: self.load_from_cloud() for entry in utils.ensure_listable(items): # remove all matching entries while entry in self.current: self.current.remove(entry) self.save_to_cloud()
class PreSubscriptionRegistry(object): '''A registry representing the presubscription JSON array of objects''' def __init__(self, api): '''New registry instance''' pass def load_from_cloud(self): '''Sync - read''' pass def save_to_cloud(self): '''Sync - write''' pass def add(self, items): '''Add entry to global presubs list''' pass def remove(self, items): '''Remove entry from global presubs list''' pass
6
6
6
0
5
1
2
0.32
1
0
0
0
5
2
5
5
38
5
25
10
19
8
22
10
16
3
1
3
9
2,301
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/security/enums.py
mbed_cloud.foundation.entities.security.enums.CertificateEnrollmentEnrollResultEnum
class CertificateEnrollmentEnrollResultEnum(BaseEnum): """Represents expected values of `CertificateEnrollmentEnrollResultEnum` This is used by Entities in the "security" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ FAILURE = "failure" SUCCESS = "success" values = frozenset(("failure", "success"))
class CertificateEnrollmentEnrollResultEnum(BaseEnum): '''Represents expected values of `CertificateEnrollmentEnrollResultEnum` This is used by Entities in the "security" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,302
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/security/certificate_issuer_config.py
mbed_cloud.foundation.entities.security.certificate_issuer_config.CertificateIssuerConfig
class CertificateIssuerConfig(Entity): """Represents the `CertificateIssuerConfig` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = ["certificate_issuer_id", "created_at", "id", "reference", "updated_at"] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, certificate_issuer_id=None, created_at=None, id=None, reference=None, updated_at=None ): """Creates a local `CertificateIssuerConfig` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param certificate_issuer_id: (Required) The ID of the certificate issuer. Null if Device Management internal HSM is used. :type certificate_issuer_id: str :param created_at: Created UTC time RFC3339. :type created_at: datetime :param id: (Required) The ID of the certificate issuer configuration. :type id: str :param reference: (Required) The certificate name to which the certificate issuer configuration applies. :type reference: str :param updated_at: Updated UTC time RFC3339. :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._certificate_issuer_id = fields.StringField(value=certificate_issuer_id) self._created_at = fields.DateTimeField(value=created_at) self._id = fields.StringField(value=id) self._reference = fields.StringField(value=reference) self._updated_at = fields.DateTimeField(value=updated_at) @property def certificate_issuer_id(self): """The ID of the certificate issuer. Null if Device Management internal HSM is used. This field must be set when creating a new CertificateIssuerConfig Entity. api example: '01648415a2a30242ac18000500000000' :rtype: str """ return self._certificate_issuer_id.value @certificate_issuer_id.setter def certificate_issuer_id(self, value): """Set value of `certificate_issuer_id` :param value: value to set :type value: str """ self._certificate_issuer_id.set(value) @property def created_at(self): """Created UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime """ return self._created_at.value @property def id(self): """The ID of the certificate issuer configuration. This field must be set when updating or deleting an existing CertificateIssuerConfig Entity. api example: '01648415a2a30242ac18000500000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def reference(self): """The certificate name to which the certificate issuer configuration applies. This field must be set when creating a new CertificateIssuerConfig Entity. api example: 'customer.dlms' :rtype: str """ return self._reference.value @reference.setter def reference(self, value): """Set value of `reference` :param value: value to set :type value: str """ self._reference.set(value) @property def updated_at(self): """Updated UTC time RFC3339. api example: '2017-02-01T00:00:00Z' :rtype: datetime """ return self._updated_at.value def create(self): """Create certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations>`_. :rtype: CertificateIssuerConfig """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._certificate_issuer_id.value_set: body_params["certificate_issuer_id"] = self._certificate_issuer_id.to_api() if self._reference.value_set: body_params["reference"] = self._reference.to_api() return self._client.call_api( method="post", path="/v3/certificate-issuer-configurations", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig """ return self._client.call_api( method="delete", path="/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}", content_type="application/json", path_params={"certificate-issuer-configuration-id": self._id.to_api()}, unpack=self, ) def get_default(self): """Get certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/lwm2m>`_. :rtype: CertificateIssuerConfig """ return self._client.call_api( method="get", path="/v3/certificate-issuer-configurations/lwm2m", content_type="application/json", unpack=self, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get certificate issuer configurations. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations>`_. **API Filters** The following filters are supported by the API when listing CertificateIssuerConfig entities: +-----------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========+======+======+======+======+======+======+======+ | reference | Y | | | | | | | +-----------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import CertificateIssuerConfig from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("reference", "eq", <filter value>) for certificate_issuer_config in CertificateIssuerConfig().list(filter=api_filter): print(certificate_issuer_config.reference) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateIssuerConfig) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CertificateIssuerConfig from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CertificateIssuerConfig._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CertificateIssuerConfig._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CertificateIssuerConfig, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """Get certificate issuer configurations. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/certificate-issuer-configurations", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig """ return self._client.call_api( method="get", path="/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}", content_type="application/json", path_params={"certificate-issuer-configuration-id": self._id.to_api()}, unpack=self, ) def update(self): """Update certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._certificate_issuer_id.value_set: body_params["certificate_issuer_id"] = self._certificate_issuer_id.to_api() return self._client.call_api( method="put", path="/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}", content_type="application/json", body_params=body_params, path_params={"certificate-issuer-configuration-id": self._id.to_api()}, unpack=self, )
class CertificateIssuerConfig(Entity): '''Represents the `CertificateIssuerConfig` entity in Pelion Device Management''' def __init__( self, _client=None, certificate_issuer_id=None, created_at=None, id=None, reference=None, updated_at=None ): '''Creates a local `CertificateIssuerConfig` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param certificate_issuer_id: (Required) The ID of the certificate issuer. Null if Device Management internal HSM is used. :type certificate_issuer_id: str :param created_at: Created UTC time RFC3339. :type created_at: datetime :param id: (Required) The ID of the certificate issuer configuration. :type id: str :param reference: (Required) The certificate name to which the certificate issuer configuration applies. :type reference: str :param updated_at: Updated UTC time RFC3339. :type updated_at: datetime ''' pass @property def certificate_issuer_id(self): '''The ID of the certificate issuer. Null if Device Management internal HSM is used. This field must be set when creating a new CertificateIssuerConfig Entity. api example: '01648415a2a30242ac18000500000000' :rtype: str ''' pass @certificate_issuer_id.setter def certificate_issuer_id(self): '''Set value of `certificate_issuer_id` :param value: value to set :type value: str ''' pass @property def created_at(self): '''Created UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime ''' pass @property def id(self): '''The ID of the certificate issuer configuration. This field must be set when updating or deleting an existing CertificateIssuerConfig Entity. api example: '01648415a2a30242ac18000500000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def reference(self): '''The certificate name to which the certificate issuer configuration applies. This field must be set when creating a new CertificateIssuerConfig Entity. api example: 'customer.dlms' :rtype: str ''' pass @reference.setter def reference(self): '''Set value of `reference` :param value: value to set :type value: str ''' pass @property def updated_at(self): '''Updated UTC time RFC3339. api example: '2017-02-01T00:00:00Z' :rtype: datetime ''' pass def created_at(self): '''Create certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations>`_. :rtype: CertificateIssuerConfig ''' pass def delete(self): '''Delete certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig ''' pass def get_default(self): '''Get certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/lwm2m>`_. :rtype: CertificateIssuerConfig ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Get certificate issuer configurations. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations>`_. **API Filters** The following filters are supported by the API when listing CertificateIssuerConfig entities: +-----------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========+======+======+======+======+======+======+======+ | reference | Y | | | | | | | +-----------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import CertificateIssuerConfig from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("reference", "eq", <filter value>) for certificate_issuer_config in CertificateIssuerConfig().list(filter=api_filter): print(certificate_issuer_config.reference) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateIssuerConfig) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''Get certificate issuer configurations. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig ''' pass def updated_at(self): '''Update certificate issuer configuration. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}>`_. :rtype: CertificateIssuerConfig ''' pass
25
17
20
5
7
9
2
1.22
1
7
4
0
16
5
16
27
358
92
120
42
90
146
63
32
43
5
2
2
24
2,303
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/enums.py
mbed_cloud.foundation.entities.device_update.enums.CampaignStatisticsSummaryStatusEnum
class CampaignStatisticsSummaryStatusEnum(BaseEnum): """Represents expected values of `CampaignStatisticsSummaryStatusEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ FAIL = "FAIL" INFO = "INFO" SKIPPED = "SKIPPED" SUCCESS = "SUCCESS" values = frozenset(("FAIL", "INFO", "SKIPPED", "SUCCESS"))
class CampaignStatisticsSummaryStatusEnum(BaseEnum): '''Represents expected values of `CampaignStatisticsSummaryStatusEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
1
16
4
6
6
5
6
6
6
5
0
2
0
0
2,304
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/enums.py
mbed_cloud.foundation.entities.device_update.enums.FirmwareImageOrderEnum
class FirmwareImageOrderEnum(BaseEnum): """Represents expected values of `FirmwareImageOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ ASC = "ASC" DESC = "DESC" values = frozenset(("ASC", "DESC"))
class FirmwareImageOrderEnum(BaseEnum): '''Represents expected values of `FirmwareImageOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,305
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/enums.py
mbed_cloud.foundation.entities.device_update.enums.FirmwareManifestOrderEnum
class FirmwareManifestOrderEnum(BaseEnum): """Represents expected values of `FirmwareManifestOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ ASC = "ASC" DESC = "DESC" values = frozenset(("ASC", "DESC"))
class FirmwareManifestOrderEnum(BaseEnum): '''Represents expected values of `FirmwareManifestOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,306
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/enums.py
mbed_cloud.foundation.entities.device_update.enums.UpdateCampaignOrderEnum
class UpdateCampaignOrderEnum(BaseEnum): """Represents expected values of `UpdateCampaignOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ ASC = "ASC" DESC = "DESC" values = frozenset(("ASC", "DESC"))
class UpdateCampaignOrderEnum(BaseEnum): '''Represents expected values of `UpdateCampaignOrderEnum` This is used by Entities in the "device_update" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,307
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/firmware_image.py
mbed_cloud.foundation.entities.device_update.firmware_image.FirmwareImage
class FirmwareImage(Entity): """Represents the `FirmwareImage` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "created_at", "datafile_checksum", "datafile_size", "datafile_url", "description", "id", "name", "updated_at", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {"datafile": "datafile_url"} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {"datafile_url": "datafile"} def __init__( self, _client=None, created_at=None, datafile_checksum=None, datafile_size=None, datafile_url=None, description=None, id=None, name=None, updated_at=None, ): """Creates a local `FirmwareImage` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the object was created :type created_at: datetime :param datafile_checksum: The checksum (sha256) generated for the datafile :type datafile_checksum: str :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The firmware image file URL :type datafile_url: str :param description: The description of the object :type description: str :param id: (Required) The firmware image ID :type id: str :param name: The firmware image name :type name: str :param updated_at: The time the object was updated :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._created_at = fields.DateTimeField(value=created_at) self._datafile_checksum = fields.StringField(value=datafile_checksum) self._datafile_size = fields.IntegerField(value=datafile_size) self._datafile_url = fields.StringField(value=datafile_url) self._description = fields.StringField(value=description) self._id = fields.StringField(value=id) self._name = fields.StringField(value=name) self._updated_at = fields.DateTimeField(value=updated_at) @property def created_at(self): """The time the object was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def datafile_checksum(self): """The checksum (sha256) generated for the datafile api example: '0000000000000000000000000000000000000000000000000000000000000000' :rtype: str """ return self._datafile_checksum.value @property def datafile_size(self): """The size of the datafile in bytes :rtype: int """ return self._datafile_size.value @property def datafile_url(self): """The firmware image file URL api example: 'http://example.com/00000000000000000000000000000000' :rtype: str """ return self._datafile_url.value @property def description(self): """The description of the object :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def id(self): """The firmware image ID This field must be set when updating or deleting an existing FirmwareImage Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def name(self): """The firmware image name :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def updated_at(self): """The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._updated_at.value def create(self, firmware_image_file): """Create an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/>`_. :param firmware_image_file: The firmware image file to upload Files can be provided as a file object or a path to an existing file on disk. :type firmware_image_file: file :rtype: FirmwareImage """ auto_close_firmware_image_file = False # If firmware_image_file is a string rather than a file, treat as a path and attempt to open the file. if firmware_image_file and isinstance(firmware_image_file, six.string_types): firmware_image_file = open(firmware_image_file, "rb") auto_close_firmware_image_file = True try: return self._client.call_api( method="post", path="/v3/firmware-images/", stream_params={ "description": (None, self._description.to_api(), "text/plain"), "datafile": ("firmware_image_file.bin", firmware_image_file, "application/octet-stream"), "name": (None, self._name.to_api(), "text/plain"), }, unpack=self, ) finally: # Calling the API may result in an exception being raised so close the files in a finally statement. # Note: Files are only closed if they were opened by the method. if auto_close_firmware_image_file: firmware_image_file.close() def delete(self): """Delete an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/{image_id}/>`_. :rtype: FirmwareImage """ return self._client.call_api( method="delete", path="/v3/firmware-images/{image_id}/", content_type="application/json", path_params={"image_id": self._id.to_api()}, unpack=self, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all images `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/>`_. **API Filters** The following filters are supported by the API when listing FirmwareImage entities: +-------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===================+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_checksum | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_size | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_url | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +-------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import FirmwareImage from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for firmware_image in FirmwareImage().list(filter=api_filter): print(firmware_image.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(FirmwareImage) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import FirmwareImage from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=FirmwareImage._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = FirmwareImage._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=FirmwareImage, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List all images :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.FirmwareImageOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/firmware-images/", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/{image_id}/>`_. :rtype: FirmwareImage """ return self._client.call_api( method="get", path="/v3/firmware-images/{image_id}/", content_type="application/json", path_params={"image_id": self._id.to_api()}, unpack=self, )
class FirmwareImage(Entity): '''Represents the `FirmwareImage` entity in Pelion Device Management''' def __init__( self, _client=None, created_at=None, datafile_checksum=None, datafile_size=None, datafile_url=None, description=None, id=None, name=None, updated_at=None, ): '''Creates a local `FirmwareImage` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the object was created :type created_at: datetime :param datafile_checksum: The checksum (sha256) generated for the datafile :type datafile_checksum: str :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The firmware image file URL :type datafile_url: str :param description: The description of the object :type description: str :param id: (Required) The firmware image ID :type id: str :param name: The firmware image name :type name: str :param updated_at: The time the object was updated :type updated_at: datetime ''' pass @property def created_at(self): '''The time the object was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def datafile_checksum(self): '''The checksum (sha256) generated for the datafile api example: '0000000000000000000000000000000000000000000000000000000000000000' :rtype: str ''' pass @property def datafile_size(self): '''The size of the datafile in bytes :rtype: int ''' pass @property def datafile_url(self): '''The firmware image file URL api example: 'http://example.com/00000000000000000000000000000000' :rtype: str ''' pass @property def description(self): '''The description of the object :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def id(self): '''The firmware image ID This field must be set when updating or deleting an existing FirmwareImage Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def name(self): '''The firmware image name :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def updated_at(self): '''The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass def created_at(self): '''Create an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/>`_. :param firmware_image_file: The firmware image file to upload Files can be provided as a file object or a path to an existing file on disk. :type firmware_image_file: file :rtype: FirmwareImage ''' pass def delete(self): '''Delete an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/{image_id}/>`_. :rtype: FirmwareImage ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all images `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/>`_. **API Filters** The following filters are supported by the API when listing FirmwareImage entities: +-------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===================+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_checksum | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_size | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | datafile_url | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +-------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +-------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import FirmwareImage from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for firmware_image in FirmwareImage().list(filter=api_filter): print(firmware_image.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(FirmwareImage) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List all images :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get an image `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-images/{image_id}/>`_. :rtype: FirmwareImage ''' pass
29
18
20
4
7
9
1
1.17
1
8
5
0
17
8
17
28
390
93
137
57
94
160
67
35
46
5
2
2
24
2,308
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/firmware_manifest.py
mbed_cloud.foundation.entities.device_update.firmware_manifest.FirmwareManifest
class FirmwareManifest(Entity): """Represents the `FirmwareManifest` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "created_at", "datafile_size", "datafile_url", "description", "device_class", "id", "key_table_url", "name", "timestamp", "updated_at", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {"datafile": "datafile_url", "key_table": "key_table_url"} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {"datafile_url": "datafile", "key_table_url": "key_table"} def __init__( self, _client=None, created_at=None, datafile_size=None, datafile_url=None, description=None, device_class=None, id=None, key_table_url=None, name=None, timestamp=None, updated_at=None, ): """Creates a local `FirmwareManifest` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the object was created :type created_at: datetime :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The URL of the firmware manifest binary :type datafile_url: str :param description: The description of the firmware manifest :type description: str :param device_class: The class of the device :type device_class: str :param id: (Required) The firmware manifest ID :type id: str :param key_table_url: The key table of pre-shared keys for devices :type key_table_url: str :param name: The name of the object :type name: str :param timestamp: The firmware manifest version as a timestamp :type timestamp: datetime :param updated_at: The time the object was updated :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._created_at = fields.DateTimeField(value=created_at) self._datafile_size = fields.IntegerField(value=datafile_size) self._datafile_url = fields.StringField(value=datafile_url) self._description = fields.StringField(value=description) self._device_class = fields.StringField(value=device_class) self._id = fields.StringField(value=id) self._key_table_url = fields.StringField(value=key_table_url) self._name = fields.StringField(value=name) self._timestamp = fields.DateTimeField(value=timestamp) self._updated_at = fields.DateTimeField(value=updated_at) @property def created_at(self): """The time the object was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def datafile_size(self): """The size of the datafile in bytes :rtype: int """ return self._datafile_size.value @property def datafile_url(self): """The URL of the firmware manifest binary api example: 'http://example.com/00000000000000000000000000000000' :rtype: str """ return self._datafile_url.value @property def description(self): """The description of the firmware manifest :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def device_class(self): """The class of the device api example: '00000000-0000-0000-0000-000000000000' :rtype: str """ return self._device_class.value @property def id(self): """The firmware manifest ID This field must be set when updating or deleting an existing FirmwareManifest Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def key_table_url(self): """The key table of pre-shared keys for devices api example: 'http://example.com' :rtype: str """ return self._key_table_url.value @property def name(self): """The name of the object :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def timestamp(self): """The firmware manifest version as a timestamp api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._timestamp.value @property def updated_at(self): """The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._updated_at.value def create(self, firmware_manifest_file, key_table_file=None): """Upload a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/>`_. :param firmware_manifest_file: The manifest file to create. The API gateway enforces the account- specific file size. Files can be provided as a file object or a path to an existing file on disk. :type firmware_manifest_file: file :param key_table_file: The key table of pre-shared keys for devices Files can be provided as a file object or a path to an existing file on disk. :type key_table_file: file :rtype: FirmwareManifest """ auto_close_firmware_manifest_file = False auto_close_key_table_file = False # If firmware_manifest_file is a string rather than a file, treat as a path and attempt to open the file. if firmware_manifest_file and isinstance(firmware_manifest_file, six.string_types): firmware_manifest_file = open(firmware_manifest_file, "rb") auto_close_firmware_manifest_file = True # If key_table_file is a string rather than a file, treat as a path and attempt to open the file. if key_table_file and isinstance(key_table_file, six.string_types): key_table_file = open(key_table_file, "rb") auto_close_key_table_file = True try: return self._client.call_api( method="post", path="/v3/firmware-manifests/", stream_params={ "description": (None, self._description.to_api(), "text/plain"), "datafile": ("firmware_manifest_file.bin", firmware_manifest_file, "application/octet-stream"), "key_table": ("key_table_file.bin", key_table_file, "application/octet-stream"), "name": (None, self._name.to_api(), "text/plain"), }, unpack=self, ) finally: # Calling the API may result in an exception being raised so close the files in a finally statement. # Note: Files are only closed if they were opened by the method. if auto_close_firmware_manifest_file: firmware_manifest_file.close() if auto_close_key_table_file: key_table_file.close() def delete(self): """Delete a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/{manifest_id}/>`_. :rtype: FirmwareManifest """ return self._client.call_api( method="delete", path="/v3/firmware-manifests/{manifest_id}/", content_type="application/json", path_params={"manifest_id": self._id.to_api()}, unpack=self, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List manifests `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/>`_. **API Filters** The following filters are supported by the API when listing FirmwareManifest entities: +---------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===============+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | datafile_size | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | datafile_url | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | timestamp | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import FirmwareManifest from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for firmware_manifest in FirmwareManifest().list(filter=api_filter): print(firmware_manifest.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(FirmwareManifest) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import FirmwareManifest from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=FirmwareManifest._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = FirmwareManifest._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=FirmwareManifest, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List manifests :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.FirmwareManifestOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/firmware-manifests/", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/{manifest_id}/>`_. :rtype: FirmwareManifest """ return self._client.call_api( method="get", path="/v3/firmware-manifests/{manifest_id}/", content_type="application/json", path_params={"manifest_id": self._id.to_api()}, unpack=self, )
class FirmwareManifest(Entity): '''Represents the `FirmwareManifest` entity in Pelion Device Management''' def __init__( self, _client=None, created_at=None, datafile_size=None, datafile_url=None, description=None, device_class=None, id=None, key_table_url=None, name=None, timestamp=None, updated_at=None, ): '''Creates a local `FirmwareManifest` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the object was created :type created_at: datetime :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The URL of the firmware manifest binary :type datafile_url: str :param description: The description of the firmware manifest :type description: str :param device_class: The class of the device :type device_class: str :param id: (Required) The firmware manifest ID :type id: str :param key_table_url: The key table of pre-shared keys for devices :type key_table_url: str :param name: The name of the object :type name: str :param timestamp: The firmware manifest version as a timestamp :type timestamp: datetime :param updated_at: The time the object was updated :type updated_at: datetime ''' pass @property def created_at(self): '''The time the object was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def datafile_size(self): '''The size of the datafile in bytes :rtype: int ''' pass @property def datafile_url(self): '''The URL of the firmware manifest binary api example: 'http://example.com/00000000000000000000000000000000' :rtype: str ''' pass @property def description(self): '''The description of the firmware manifest :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def device_class(self): '''The class of the device api example: '00000000-0000-0000-0000-000000000000' :rtype: str ''' pass @property def id(self): '''The firmware manifest ID This field must be set when updating or deleting an existing FirmwareManifest Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def key_table_url(self): '''The key table of pre-shared keys for devices api example: 'http://example.com' :rtype: str ''' pass @property def name(self): '''The name of the object :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def timestamp(self): '''The firmware manifest version as a timestamp api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def updated_at(self): '''The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass def created_at(self): '''Upload a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/>`_. :param firmware_manifest_file: The manifest file to create. The API gateway enforces the account- specific file size. Files can be provided as a file object or a path to an existing file on disk. :type firmware_manifest_file: file :param key_table_file: The key table of pre-shared keys for devices Files can be provided as a file object or a path to an existing file on disk. :type key_table_file: file :rtype: FirmwareManifest ''' pass def delete(self): '''Delete a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/{manifest_id}/>`_. :rtype: FirmwareManifest ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List manifests `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/>`_. **API Filters** The following filters are supported by the API when listing FirmwareManifest entities: +---------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===============+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | datafile_size | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | datafile_url | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | timestamp | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import FirmwareManifest from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for firmware_manifest in FirmwareManifest().list(filter=api_filter): print(firmware_manifest.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(FirmwareManifest) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List manifests :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a manifest `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/firmware-manifests/{manifest_id}/>`_. :rtype: FirmwareManifest ''' pass
33
20
20
4
7
9
1
1.15
1
8
5
0
19
10
19
30
439
104
156
66
107
179
79
40
56
5
2
2
28
2,309
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/update_campaign.py
mbed_cloud.foundation.entities.device_update.update_campaign.UpdateCampaign
class UpdateCampaign(Entity): """Represents the `UpdateCampaign` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "autostop_reason", "created_at", "description", "device_filter", "device_filter_helper", "finished", "id", "name", "phase", "root_manifest_id", "root_manifest_url", "started_at", "updated_at", "when", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, autostop_reason=None, created_at=None, description=None, device_filter=None, device_filter_helper=None, finished=None, id=None, name=None, phase=None, root_manifest_id=None, root_manifest_url=None, started_at=None, updated_at=None, when=None, ): """Creates a local `UpdateCampaign` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param autostop_reason: Text description of why a campaign failed to start or why a campaign stopped. :type autostop_reason: str :param created_at: The time the update campaign was created :type created_at: datetime :param description: An optional description of the campaign :type description: str :param device_filter: (Required) The filter for the devices the campaign is targeting at :type device_filter: str :param device_filter_helper: Helper for creating the device filter string. :type device_filter_helper: mbed_cloud.client.api_filter.ApiFilter :param finished: The campaign finish timestamp :type finished: datetime :param id: (Required) The campaign ID :type id: str :param name: The campaign name :type name: str :param phase: The current phase of the campaign. :type phase: str :param root_manifest_id: :type root_manifest_id: str :param root_manifest_url: :type root_manifest_url: str :param started_at: :type started_at: datetime :param updated_at: The time the object was updated :type updated_at: datetime :param when: The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. :type when: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._autostop_reason = fields.StringField(value=autostop_reason) self._created_at = fields.DateTimeField(value=created_at) self._description = fields.StringField(value=description) self._device_filter = fields.StringField(value=device_filter) self._device_filter_helper = fields.DictField(value=device_filter_helper) self._finished = fields.DateTimeField(value=finished) self._id = fields.StringField(value=id) self._name = fields.StringField(value=name) self._phase = fields.StringField(value=phase) self._root_manifest_id = fields.StringField(value=root_manifest_id) self._root_manifest_url = fields.StringField(value=root_manifest_url) self._started_at = fields.DateTimeField(value=started_at) self._updated_at = fields.DateTimeField(value=updated_at) self._when = fields.DateTimeField(value=when) @property def autostop_reason(self): """Text description of why a campaign failed to start or why a campaign stopped. api example: 'Insufficient billing credit.' :rtype: str """ return self._autostop_reason.value @property def created_at(self): """The time the update campaign was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def description(self): """An optional description of the campaign :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def device_filter(self): """The filter for the devices the campaign is targeting at This field must be set when creating a new UpdateCampaign Entity. api example: 'id__eq=00000000000000000000000000000000' :rtype: str """ return self._device_filter.value @device_filter.setter def device_filter(self, value): """Set value of `device_filter` :param value: value to set :type value: str """ self._device_filter.set(value) @property def device_filter_helper(self): """Helper for creating the device filter string. This helper can be used instead of setting device filter directly. This allows the campaign filter to be created in a way which is similar to the device listing filter. - See mbed_cloud.foundation.entities.devices.device.Device.list for details. :rtype: mbed_cloud.client.api_filter.ApiFilter """ from mbed_cloud.foundation._custom_methods import device_filter_helper_getter return device_filter_helper_getter(self=self) @device_filter_helper.setter def device_filter_helper(self, value): """Set value of `device_filter_helper` :param value: value to set :type value: mbed_cloud.client.api_filter.ApiFilter """ from mbed_cloud.foundation._custom_methods import device_filter_helper_setter device_filter_helper_setter(self=self, value=value) @property def finished(self): """The campaign finish timestamp api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._finished.value @property def id(self): """The campaign ID This field must be set when updating or deleting an existing UpdateCampaign Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def name(self): """The campaign name api example: 'campaign' :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def phase(self): """The current phase of the campaign. :rtype: str """ return self._phase.value @property def root_manifest_id(self): """ api example: '00000000000000000000000000000000' :rtype: str """ return self._root_manifest_id.value @root_manifest_id.setter def root_manifest_id(self, value): """Set value of `root_manifest_id` :param value: value to set :type value: str """ self._root_manifest_id.set(value) @property def root_manifest_url(self): """ api example: 'http://example.com/00000000000000000000000000000000' :rtype: str """ return self._root_manifest_url.value @property def started_at(self): """ api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._started_at.value @property def updated_at(self): """The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._updated_at.value @property def when(self): """The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._when.value @when.setter def when(self, value): """Set value of `when` :param value: value to set :type value: datetime """ self._when.set(value) def archive(self): """Archive a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/archive>`_. :rtype: UpdateCampaign """ return self._client.call_api( method="post", path="/v3/update-campaigns/{campaign_id}/archive", content_type="application/json", path_params={"campaign_id": self._id.to_api()}, unpack=self, ) def create(self): """Create a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/>`_. :rtype: UpdateCampaign """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._description.value_set: body_params["description"] = self._description.to_api() if self._device_filter.value_set: body_params["device_filter"] = self._device_filter.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() if self._root_manifest_id.value_set: body_params["root_manifest_id"] = self._root_manifest_id.to_api() if self._when.value_set: body_params["when"] = self._when.to_api() return self._client.call_api( method="post", path="/v3/update-campaigns/", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign """ return self._client.call_api( method="delete", path="/v3/update-campaigns/{campaign_id}/", content_type="application/json", path_params={"campaign_id": self._id.to_api()}, unpack=self, ) def device_metadata(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all campaign device metadata `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/campaign-device-metadata/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignDeviceMetadata) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CampaignDeviceMetadata from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CampaignDeviceMetadata._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CampaignDeviceMetadata._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CampaignDeviceMetadata, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_device_metadata, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all campaigns `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/>`_. **API Filters** The following filters are supported by the API when listing UpdateCampaign entities: +------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==================+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | device_filter | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | finished | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | root_manifest_id | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | started_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | when | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import UpdateCampaign from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for update_campaign in UpdateCampaign().list(filter=api_filter): print(update_campaign.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records. Acceptable values: ASC, DESC. Default: ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(UpdateCampaign) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import UpdateCampaign from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=UpdateCampaign._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = UpdateCampaign._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=UpdateCampaign, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_device_metadata(self, after=None, filter=None, order=None, limit=None, include=None): """List all campaign device metadata :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.UpdateCampaignOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/campaign-device-metadata/", content_type="application/json", query_params=query_params, path_params={"campaign_id": self._id.to_api()}, unpack=False, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List all campaigns :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records. Acceptable values: ASC, DESC. Default: ASC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.UpdateCampaignOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/update-campaigns/", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign """ return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/", content_type="application/json", path_params={"campaign_id": self._id.to_api()}, unpack=self, ) def start(self): """Start a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/start>`_. :rtype: UpdateCampaign """ return self._client.call_api( method="post", path="/v3/update-campaigns/{campaign_id}/start", content_type="application/json", path_params={"campaign_id": self._id.to_api()}, unpack=self, ) def stop(self): """Stop a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/stop>`_. :rtype: UpdateCampaign """ return self._client.call_api( method="post", path="/v3/update-campaigns/{campaign_id}/stop", content_type="application/json", path_params={"campaign_id": self._id.to_api()}, unpack=self, ) def update(self): """Modify a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._description.value_set: body_params["description"] = self._description.to_api() if self._device_filter.value_set: body_params["device_filter"] = self._device_filter.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() if self._root_manifest_id.value_set: body_params["root_manifest_id"] = self._root_manifest_id.to_api() if self._when.value_set: body_params["when"] = self._when.to_api() return self._client.call_api( method="put", path="/v3/update-campaigns/{campaign_id}/", content_type="application/json", body_params=body_params, path_params={"campaign_id": self._id.to_api()}, unpack=self, )
class UpdateCampaign(Entity): '''Represents the `UpdateCampaign` entity in Pelion Device Management''' def __init__( self, _client=None, autostop_reason=None, created_at=None, description=None, device_filter=None, device_filter_helper=None, finished=None, id=None, name=None, phase=None, root_manifest_id=None, root_manifest_url=None, started_at=None, updated_at=None, when=None, ): '''Creates a local `UpdateCampaign` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param autostop_reason: Text description of why a campaign failed to start or why a campaign stopped. :type autostop_reason: str :param created_at: The time the update campaign was created :type created_at: datetime :param description: An optional description of the campaign :type description: str :param device_filter: (Required) The filter for the devices the campaign is targeting at :type device_filter: str :param device_filter_helper: Helper for creating the device filter string. :type device_filter_helper: mbed_cloud.client.api_filter.ApiFilter :param finished: The campaign finish timestamp :type finished: datetime :param id: (Required) The campaign ID :type id: str :param name: The campaign name :type name: str :param phase: The current phase of the campaign. :type phase: str :param root_manifest_id: :type root_manifest_id: str :param root_manifest_url: :type root_manifest_url: str :param started_at: :type started_at: datetime :param updated_at: The time the object was updated :type updated_at: datetime :param when: The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. :type when: datetime ''' pass @property def autostop_reason(self): '''Text description of why a campaign failed to start or why a campaign stopped. api example: 'Insufficient billing credit.' :rtype: str ''' pass @property def created_at(self): '''The time the update campaign was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def description(self): '''An optional description of the campaign :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def device_filter(self): '''The filter for the devices the campaign is targeting at This field must be set when creating a new UpdateCampaign Entity. api example: 'id__eq=00000000000000000000000000000000' :rtype: str ''' pass @device_filter.setter def device_filter(self): '''Set value of `device_filter` :param value: value to set :type value: str ''' pass @property def device_filter_helper(self): '''Helper for creating the device filter string. This helper can be used instead of setting device filter directly. This allows the campaign filter to be created in a way which is similar to the device listing filter. - See mbed_cloud.foundation.entities.devices.device.Device.list for details. :rtype: mbed_cloud.client.api_filter.ApiFilter ''' pass @device_filter_helper.setter def device_filter_helper(self): '''Set value of `device_filter_helper` :param value: value to set :type value: mbed_cloud.client.api_filter.ApiFilter ''' pass @property def finished(self): '''The campaign finish timestamp api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def id(self): '''The campaign ID This field must be set when updating or deleting an existing UpdateCampaign Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def name(self): '''The campaign name api example: 'campaign' :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def phase(self): '''The current phase of the campaign. :rtype: str ''' pass @property def root_manifest_id(self): ''' api example: '00000000000000000000000000000000' :rtype: str ''' pass @root_manifest_id.setter def root_manifest_id(self): '''Set value of `root_manifest_id` :param value: value to set :type value: str ''' pass @property def root_manifest_url(self): ''' api example: 'http://example.com/00000000000000000000000000000000' :rtype: str ''' pass @property def started_at(self): ''' api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def updated_at(self): '''The time the object was updated api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def when(self): '''The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @when.setter def when(self): '''Set value of `when` :param value: value to set :type value: datetime ''' pass def archive(self): '''Archive a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/archive>`_. :rtype: UpdateCampaign ''' pass def created_at(self): '''Create a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/>`_. :rtype: UpdateCampaign ''' pass def delete(self): '''Delete a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign ''' pass def device_metadata(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all campaign device metadata `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/campaign-device-metadata/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignDeviceMetadata) ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all campaigns `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/>`_. **API Filters** The following filters are supported by the API when listing UpdateCampaign entities: +------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==================+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | device_filter | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | finished | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | root_manifest_id | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | started_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ | when | | | Y | Y | Y | Y | | +------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import UpdateCampaign from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for update_campaign in UpdateCampaign().list(filter=api_filter): print(update_campaign.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records. Acceptable values: ASC, DESC. Default: ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(UpdateCampaign) ''' pass def _paginate_device_metadata(self, after=None, filter=None, order=None, limit=None, include=None): '''List all campaign device metadata :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List all campaigns :param after: The ID of the the item after which to retrieve the next page :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records. Acceptable values: ASC, DESC. Default: ASC :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: A comma-separated list of data fields to return. Currently supported: total_count :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign ''' pass def started_at(self): '''Start a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/start>`_. :rtype: UpdateCampaign ''' pass def stop(self): '''Stop a campaign. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/stop>`_. :rtype: UpdateCampaign ''' pass def updated_at(self): '''Modify a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/>`_. :rtype: UpdateCampaign ''' pass
55
34
19
4
7
8
2
1.06
1
10
7
0
33
14
33
44
715
168
266
102
186
281
135
64
93
6
2
2
53
2,310
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device.py
mbed_cloud.foundation.entities.devices.device.Device
class Device(Entity): """Represents the `Device` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "account_id", "auto_update", "bootstrap_expiration_date", "bootstrapped_timestamp", "ca_id", "connector_expiration_date", "created_at", "custom_attributes", "deployed_state", "deployment", "description", "device_class", "device_execution_mode", "device_key", "endpoint_name", "endpoint_type", "enrolment_list_timestamp", "firmware_checksum", "host_gateway", "id", "issuer_fingerprint", "manifest", "manifest_timestamp", "mechanism", "mechanism_url", "name", "serial_number", "state", "updated_at", "vendor_id", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, account_id=None, auto_update=None, bootstrap_expiration_date=None, bootstrapped_timestamp=None, ca_id=None, connector_expiration_date=None, created_at=None, custom_attributes=None, deployed_state=None, deployment=None, description=None, device_class=None, device_execution_mode=None, device_key=None, endpoint_name=None, endpoint_type=None, enrolment_list_timestamp=None, firmware_checksum=None, host_gateway=None, id=None, issuer_fingerprint=None, manifest=None, manifest_timestamp=None, mechanism=None, mechanism_url=None, name=None, serial_number=None, state=None, updated_at=None, vendor_id=None, ): """Creates a local `Device` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: The ID of the associated account. :type account_id: str :param auto_update: DEPRECATED: Mark this device for automatic firmware update. :type auto_update: bool :param bootstrap_expiration_date: The expiration date of the certificate used to connect to bootstrap server. :type bootstrap_expiration_date: date :param bootstrapped_timestamp: The timestamp of the device's most recent bootstrap process. :type bootstrapped_timestamp: datetime :param ca_id: The certificate issuer's ID. :type ca_id: str :param connector_expiration_date: The expiration date of the certificate used to connect to LwM2M server. :type connector_expiration_date: date :param created_at: The timestamp of when the device was created in the device directory. :type created_at: datetime :param custom_attributes: Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param deployed_state: DEPRECATED: The state of the device's deployment. :type deployed_state: str :param deployment: DEPRECATED: The last deployment used on the device. :type deployment: str :param description: The description of the device. :type description: str :param device_class: An ID representing the model and hardware revision of the device. :type device_class: str :param device_execution_mode: The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :type device_execution_mode: int :param device_key: The fingerprint of the device certificate. :type device_key: str :param endpoint_name: The endpoint name given to the device. :type endpoint_name: str :param endpoint_type: The endpoint type of the device. For example, the device is a gateway. :type endpoint_type: str :param enrolment_list_timestamp: The claim date/time. :type enrolment_list_timestamp: datetime :param firmware_checksum: The SHA256 checksum of the current firmware image. :type firmware_checksum: str :param host_gateway: The ID of the host gateway, if appropriate. :type host_gateway: str :param id: (Required) The ID of the device. The device ID is used across all Device Management APIs. :type id: str :param issuer_fingerprint: SHA256 fingerprint of the certificate used to validate the signature of the device certificate. :type issuer_fingerprint: str :param manifest: DEPRECATED: The URL for the current device manifest. :type manifest: str :param manifest_timestamp: The timestamp of the current manifest version. :type manifest_timestamp: datetime :param mechanism: The ID of the channel used to communicate with the device. :type mechanism: str :param mechanism_url: The address of the connector to use. :type mechanism_url: str :param name: The name of the device. :type name: str :param serial_number: The serial number of the device. :type serial_number: str :param state: The current state of the device. :type state: str :param updated_at: The time the object was updated. :type updated_at: datetime :param vendor_id: The device vendor ID. :type vendor_id: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._auto_update = fields.BooleanField(value=auto_update) self._bootstrap_expiration_date = fields.DateField(value=bootstrap_expiration_date) self._bootstrapped_timestamp = fields.DateTimeField(value=bootstrapped_timestamp) self._ca_id = fields.StringField(value=ca_id) self._connector_expiration_date = fields.DateField(value=connector_expiration_date) self._created_at = fields.DateTimeField(value=created_at) self._custom_attributes = fields.DictField(value=custom_attributes) self._deployed_state = fields.StringField(value=deployed_state, enum=enums.DeviceDeployedStateEnum) self._deployment = fields.StringField(value=deployment) self._description = fields.StringField(value=description) self._device_class = fields.StringField(value=device_class) self._device_execution_mode = fields.IntegerField(value=device_execution_mode) self._device_key = fields.StringField(value=device_key) self._endpoint_name = fields.StringField(value=endpoint_name) self._endpoint_type = fields.StringField(value=endpoint_type) self._enrolment_list_timestamp = fields.DateTimeField(value=enrolment_list_timestamp) self._firmware_checksum = fields.StringField(value=firmware_checksum) self._host_gateway = fields.StringField(value=host_gateway) self._id = fields.StringField(value=id) self._issuer_fingerprint = fields.StringField(value=issuer_fingerprint) self._manifest = fields.StringField(value=manifest) self._manifest_timestamp = fields.DateTimeField(value=manifest_timestamp) self._mechanism = fields.StringField(value=mechanism, enum=enums.DeviceMechanismEnum) self._mechanism_url = fields.StringField(value=mechanism_url) self._name = fields.StringField(value=name) self._serial_number = fields.StringField(value=serial_number) self._state = fields.StringField(value=state, enum=enums.DeviceStateEnum) self._updated_at = fields.DateTimeField(value=updated_at) self._vendor_id = fields.StringField(value=vendor_id) @property def account_id(self): """The ID of the associated account. api example: '00000000000000000000000000000000' :rtype: str """ return self._account_id.value @property def auto_update(self): """DEPRECATED: Mark this device for automatic firmware update. :rtype: bool """ return self._auto_update.value @auto_update.setter def auto_update(self, value): """Set value of `auto_update` :param value: value to set :type value: bool """ self._auto_update.set(value) @property def bootstrap_expiration_date(self): """The expiration date of the certificate used to connect to bootstrap server. :rtype: date """ return self._bootstrap_expiration_date.value @bootstrap_expiration_date.setter def bootstrap_expiration_date(self, value): """Set value of `bootstrap_expiration_date` :param value: value to set :type value: date """ self._bootstrap_expiration_date.set(value) @property def bootstrapped_timestamp(self): """The timestamp of the device's most recent bootstrap process. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._bootstrapped_timestamp.value @property def ca_id(self): """The certificate issuer's ID. api example: '00000000000000000000000000000000' :rtype: str """ return self._ca_id.value @ca_id.setter def ca_id(self, value): """Set value of `ca_id` :param value: value to set :type value: str """ self._ca_id.set(value) @property def connector_expiration_date(self): """The expiration date of the certificate used to connect to LwM2M server. :rtype: date """ return self._connector_expiration_date.value @connector_expiration_date.setter def connector_expiration_date(self, value): """Set value of `connector_expiration_date` :param value: value to set :type value: date """ self._connector_expiration_date.set(value) @property def created_at(self): """The timestamp of when the device was created in the device directory. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def custom_attributes(self): """Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. api example: {'key': 'value'} :rtype: dict """ return self._custom_attributes.value @custom_attributes.setter def custom_attributes(self, value): """Set value of `custom_attributes` :param value: value to set :type value: dict """ self._custom_attributes.set(value) @property def deployed_state(self): """DEPRECATED: The state of the device's deployment. :rtype: str """ return self._deployed_state.value @property def deployment(self): """DEPRECATED: The last deployment used on the device. :rtype: str """ return self._deployment.value @deployment.setter def deployment(self, value): """Set value of `deployment` :param value: value to set :type value: str """ self._deployment.set(value) @property def description(self): """The description of the device. api example: 'description' :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def device_class(self): """An ID representing the model and hardware revision of the device. :rtype: str """ return self._device_class.value @device_class.setter def device_class(self, value): """Set value of `device_class` :param value: value to set :type value: str """ self._device_class.set(value) @property def device_execution_mode(self): """The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :rtype: int """ return self._device_execution_mode.value @device_execution_mode.setter def device_execution_mode(self, value): """Set value of `device_execution_mode` :param value: value to set :type value: int """ self._device_execution_mode.set(value) @property def device_key(self): """The fingerprint of the device certificate. api example: '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 :00:00:00:00:00:00' :rtype: str """ return self._device_key.value @device_key.setter def device_key(self, value): """Set value of `device_key` :param value: value to set :type value: str """ self._device_key.set(value) @property def endpoint_name(self): """The endpoint name given to the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str """ return self._endpoint_name.value @property def endpoint_type(self): """The endpoint type of the device. For example, the device is a gateway. :rtype: str """ return self._endpoint_type.value @endpoint_type.setter def endpoint_type(self, value): """Set value of `endpoint_type` :param value: value to set :type value: str """ self._endpoint_type.set(value) @property def enrolment_list_timestamp(self): """The claim date/time. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._enrolment_list_timestamp.value @property def firmware_checksum(self): """The SHA256 checksum of the current firmware image. api example: '0000000000000000000000000000000000000000000000000000000000000000' :rtype: str """ return self._firmware_checksum.value @property def host_gateway(self): """The ID of the host gateway, if appropriate. :rtype: str """ return self._host_gateway.value @host_gateway.setter def host_gateway(self, value): """Set value of `host_gateway` :param value: value to set :type value: str """ self._host_gateway.set(value) @property def id(self): """The ID of the device. The device ID is used across all Device Management APIs. This field must be set when updating or deleting an existing Device Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def issuer_fingerprint(self): """SHA256 fingerprint of the certificate used to validate the signature of the device certificate. api example: 'C42EDEFC75871E4CE2146FCDA67D03DDA05CC26FDF93B17B55F42C1EADFDC322' :rtype: str """ return self._issuer_fingerprint.value @issuer_fingerprint.setter def issuer_fingerprint(self, value): """Set value of `issuer_fingerprint` :param value: value to set :type value: str """ self._issuer_fingerprint.set(value) @property def manifest(self): """DEPRECATED: The URL for the current device manifest. :rtype: str """ return self._manifest.value @manifest.setter def manifest(self, value): """Set value of `manifest` :param value: value to set :type value: str """ self._manifest.set(value) @property def manifest_timestamp(self): """The timestamp of the current manifest version. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._manifest_timestamp.value @property def mechanism(self): """The ID of the channel used to communicate with the device. :rtype: str """ return self._mechanism.value @mechanism.setter def mechanism(self, value): """Set value of `mechanism` :param value: value to set :type value: str """ self._mechanism.set(value) @property def mechanism_url(self): """The address of the connector to use. :rtype: str """ return self._mechanism_url.value @mechanism_url.setter def mechanism_url(self, value): """Set value of `mechanism_url` :param value: value to set :type value: str """ self._mechanism_url.set(value) @property def name(self): """The name of the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def serial_number(self): """The serial number of the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str """ return self._serial_number.value @serial_number.setter def serial_number(self, value): """Set value of `serial_number` :param value: value to set :type value: str """ self._serial_number.set(value) @property def state(self): """The current state of the device. :rtype: str """ return self._state.value @state.setter def state(self, value): """Set value of `state` :param value: value to set :type value: str """ self._state.set(value) @property def updated_at(self): """The time the object was updated. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._updated_at.value @property def vendor_id(self): """The device vendor ID. api example: '00000000-0000-0000-0000-000000000000' :rtype: str """ return self._vendor_id.value @vendor_id.setter def vendor_id(self, value): """Set value of `vendor_id` :param value: value to set :type value: str """ self._vendor_id.set(value) def add_to_group(self, device_group_id): """Add a device to a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/add/>`_. :param device_group_id: The ID of the group. :type device_group_id: str :rtype: """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._id.value_set: body_params["device_id"] = self._id.to_api() return self._client.call_api( method="post", path="/v3/device-groups/{device-group-id}/devices/add/", content_type="application/json", path_params={"device-group-id": fields.StringField(device_group_id).to_api()}, body_params=body_params, unpack=self, ) def create(self): """Create a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/>`_. :rtype: Device """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._auto_update.value_set: body_params["auto_update"] = self._auto_update.to_api() if self._bootstrap_expiration_date.value_set: body_params["bootstrap_expiration_date"] = self._bootstrap_expiration_date.to_api() if self._ca_id.value_set: body_params["ca_id"] = self._ca_id.to_api() if self._connector_expiration_date.value_set: body_params["connector_expiration_date"] = self._connector_expiration_date.to_api() if self._custom_attributes.value_set: body_params["custom_attributes"] = self._custom_attributes.to_api() if self._deployment.value_set: body_params["deployment"] = self._deployment.to_api() if self._description.value_set: body_params["description"] = self._description.to_api() if self._device_class.value_set: body_params["device_class"] = self._device_class.to_api() if self._device_execution_mode.value_set: body_params["device_execution_mode"] = self._device_execution_mode.to_api() if self._device_key.value_set: body_params["device_key"] = self._device_key.to_api() if self._endpoint_name.value_set: body_params["endpoint_name"] = self._endpoint_name.to_api() if self._endpoint_type.value_set: body_params["endpoint_type"] = self._endpoint_type.to_api() if self._host_gateway.value_set: body_params["host_gateway"] = self._host_gateway.to_api() if self._issuer_fingerprint.value_set: body_params["issuer_fingerprint"] = self._issuer_fingerprint.to_api() if self._manifest.value_set: body_params["manifest"] = self._manifest.to_api() if self._mechanism.value_set: body_params["mechanism"] = self._mechanism.to_api() if self._mechanism_url.value_set: body_params["mechanism_url"] = self._mechanism_url.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() if self._serial_number.value_set: body_params["serial_number"] = self._serial_number.to_api() if self._state.value_set: body_params["state"] = self._state.to_api() if self._vendor_id.value_set: body_params["vendor_id"] = self._vendor_id.to_api() return self._client.call_api( method="post", path="/v3/devices/", content_type="application/json", body_params=body_params, unpack=self ) def delete(self): """Delete a device. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device """ return self._client.call_api( method="delete", path="/v3/devices/{id}/", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all devices. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/>`_. **API Filters** The following filters are supported by the API when listing Device entities: +---------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========================+======+======+======+======+======+======+======+ | account_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | auto_update | Y | Y | | | | | | +---------------------------+------+------+------+------+------+------+------+ | bootstrap_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | bootstrapped_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | ca_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | connector_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployed_state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployment | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_execution_mode | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_key | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_type | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | enrolment_list_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | firmware_checksum | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | host_gateway | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism_url | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | serial_number | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | vendor_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import Device from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("account_id", "eq", <filter value>) for device in Device().list(filter=api_filter): print(device.account_id) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(Device) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import Device from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=Device._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = Device._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=Device, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List all devices. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/devices/", content_type="application/json", query_params=query_params, unpack=False ) def read(self): """Get a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device """ return self._client.call_api( method="get", path="/v3/devices/{id}/", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, ) def remove_from_group(self, device_group_id): """Remove a device from a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/remove/>`_. :param device_group_id: The ID of the group. :type device_group_id: str :rtype: """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._id.value_set: body_params["device_id"] = self._id.to_api() return self._client.call_api( method="post", path="/v3/device-groups/{device-group-id}/devices/remove/", content_type="application/json", path_params={"device-group-id": fields.StringField(device_group_id).to_api()}, body_params=body_params, unpack=self, ) def renew_certificate(self, certificate_name): """Request certificate renewal. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{device-id}/certificates/{certificate-name}/renew>`_. :param certificate_name: The certificate name. :type certificate_name: str :rtype: CertificateEnrollment """ from mbed_cloud.foundation import CertificateEnrollment return self._client.call_api( method="post", path="/v3/devices/{device-id}/certificates/{certificate-name}/renew", content_type="application/json", path_params={ "certificate-name": fields.StringField(certificate_name).to_api(), "device-id": self._id.to_api(), }, unpack=CertificateEnrollment, ) def update(self): """Update a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._auto_update.value_set: body_params["auto_update"] = self._auto_update.to_api() if self._ca_id.value_set: body_params["ca_id"] = self._ca_id.to_api() if self._custom_attributes.value_set: body_params["custom_attributes"] = self._custom_attributes.to_api() if self._description.value_set: body_params["description"] = self._description.to_api() if self._device_key.value_set: body_params["device_key"] = self._device_key.to_api() if self._endpoint_name.value_set: body_params["endpoint_name"] = self._endpoint_name.to_api() if self._endpoint_type.value_set: body_params["endpoint_type"] = self._endpoint_type.to_api() if self._host_gateway.value_set: body_params["host_gateway"] = self._host_gateway.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="put", path="/v3/devices/{id}/", content_type="application/json", body_params=body_params, path_params={"id": self._id.to_api()}, unpack=self, )
class Device(Entity): '''Represents the `Device` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, auto_update=None, bootstrap_expiration_date=None, bootstrapped_timestamp=None, ca_id=None, connector_expiration_date=None, created_at=None, custom_attributes=None, deployed_state=None, deployment=None, description=None, device_class=None, device_execution_mode=None, device_key=None, endpoint_name=None, endpoint_type=None, enrolment_list_timestamp=None, firmware_checksum=None, host_gateway=None, id=None, issuer_fingerprint=None, manifest=None, manifest_timestamp=None, mechanism=None, mechanism_url=None, name=None, serial_number=None, state=None, updated_at=None, vendor_id=None, ): '''Creates a local `Device` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: The ID of the associated account. :type account_id: str :param auto_update: DEPRECATED: Mark this device for automatic firmware update. :type auto_update: bool :param bootstrap_expiration_date: The expiration date of the certificate used to connect to bootstrap server. :type bootstrap_expiration_date: date :param bootstrapped_timestamp: The timestamp of the device's most recent bootstrap process. :type bootstrapped_timestamp: datetime :param ca_id: The certificate issuer's ID. :type ca_id: str :param connector_expiration_date: The expiration date of the certificate used to connect to LwM2M server. :type connector_expiration_date: date :param created_at: The timestamp of when the device was created in the device directory. :type created_at: datetime :param custom_attributes: Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param deployed_state: DEPRECATED: The state of the device's deployment. :type deployed_state: str :param deployment: DEPRECATED: The last deployment used on the device. :type deployment: str :param description: The description of the device. :type description: str :param device_class: An ID representing the model and hardware revision of the device. :type device_class: str :param device_execution_mode: The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :type device_execution_mode: int :param device_key: The fingerprint of the device certificate. :type device_key: str :param endpoint_name: The endpoint name given to the device. :type endpoint_name: str :param endpoint_type: The endpoint type of the device. For example, the device is a gateway. :type endpoint_type: str :param enrolment_list_timestamp: The claim date/time. :type enrolment_list_timestamp: datetime :param firmware_checksum: The SHA256 checksum of the current firmware image. :type firmware_checksum: str :param host_gateway: The ID of the host gateway, if appropriate. :type host_gateway: str :param id: (Required) The ID of the device. The device ID is used across all Device Management APIs. :type id: str :param issuer_fingerprint: SHA256 fingerprint of the certificate used to validate the signature of the device certificate. :type issuer_fingerprint: str :param manifest: DEPRECATED: The URL for the current device manifest. :type manifest: str :param manifest_timestamp: The timestamp of the current manifest version. :type manifest_timestamp: datetime :param mechanism: The ID of the channel used to communicate with the device. :type mechanism: str :param mechanism_url: The address of the connector to use. :type mechanism_url: str :param name: The name of the device. :type name: str :param serial_number: The serial number of the device. :type serial_number: str :param state: The current state of the device. :type state: str :param updated_at: The time the object was updated. :type updated_at: datetime :param vendor_id: The device vendor ID. :type vendor_id: str ''' pass @property def account_id(self): '''The ID of the associated account. api example: '00000000000000000000000000000000' :rtype: str ''' pass @property def auto_update(self): '''DEPRECATED: Mark this device for automatic firmware update. :rtype: bool ''' pass @auto_update.setter def auto_update(self): '''Set value of `auto_update` :param value: value to set :type value: bool ''' pass @property def bootstrap_expiration_date(self): '''The expiration date of the certificate used to connect to bootstrap server. :rtype: date ''' pass @bootstrap_expiration_date.setter def bootstrap_expiration_date(self): '''Set value of `bootstrap_expiration_date` :param value: value to set :type value: date ''' pass @property def bootstrapped_timestamp(self): '''The timestamp of the device's most recent bootstrap process. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def ca_id(self): '''The certificate issuer's ID. api example: '00000000000000000000000000000000' :rtype: str ''' pass @ca_id.setter def ca_id(self): '''Set value of `ca_id` :param value: value to set :type value: str ''' pass @property def connector_expiration_date(self): '''The expiration date of the certificate used to connect to LwM2M server. :rtype: date ''' pass @connector_expiration_date.setter def connector_expiration_date(self): '''Set value of `connector_expiration_date` :param value: value to set :type value: date ''' pass @property def created_at(self): '''The timestamp of when the device was created in the device directory. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def custom_attributes(self): '''Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. api example: {'key': 'value'} :rtype: dict ''' pass @custom_attributes.setter def custom_attributes(self): '''Set value of `custom_attributes` :param value: value to set :type value: dict ''' pass @property def deployed_state(self): '''DEPRECATED: The state of the device's deployment. :rtype: str ''' pass @property def deployment(self): '''DEPRECATED: The last deployment used on the device. :rtype: str ''' pass @deployment.setter def deployment(self): '''Set value of `deployment` :param value: value to set :type value: str ''' pass @property def description(self): '''The description of the device. api example: 'description' :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def device_class(self): '''An ID representing the model and hardware revision of the device. :rtype: str ''' pass @device_class.setter def device_class(self): '''Set value of `device_class` :param value: value to set :type value: str ''' pass @property def device_execution_mode(self): '''The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :rtype: int ''' pass @device_execution_mode.setter def device_execution_mode(self): '''Set value of `device_execution_mode` :param value: value to set :type value: int ''' pass @property def device_key(self): '''The fingerprint of the device certificate. api example: '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 :00:00:00:00:00:00' :rtype: str ''' pass @device_key.setter def device_key(self): '''Set value of `device_key` :param value: value to set :type value: str ''' pass @property def endpoint_name(self): '''The endpoint name given to the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str ''' pass @property def endpoint_type(self): '''The endpoint type of the device. For example, the device is a gateway. :rtype: str ''' pass @endpoint_type.setter def endpoint_type(self): '''Set value of `endpoint_type` :param value: value to set :type value: str ''' pass @property def enrolment_list_timestamp(self): '''The claim date/time. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def firmware_checksum(self): '''The SHA256 checksum of the current firmware image. api example: '0000000000000000000000000000000000000000000000000000000000000000' :rtype: str ''' pass @property def host_gateway(self): '''The ID of the host gateway, if appropriate. :rtype: str ''' pass @host_gateway.setter def host_gateway(self): '''Set value of `host_gateway` :param value: value to set :type value: str ''' pass @property def id(self): '''The ID of the device. The device ID is used across all Device Management APIs. This field must be set when updating or deleting an existing Device Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def issuer_fingerprint(self): '''SHA256 fingerprint of the certificate used to validate the signature of the device certificate. api example: 'C42EDEFC75871E4CE2146FCDA67D03DDA05CC26FDF93B17B55F42C1EADFDC322' :rtype: str ''' pass @issuer_fingerprint.setter def issuer_fingerprint(self): '''Set value of `issuer_fingerprint` :param value: value to set :type value: str ''' pass @property def manifest(self): '''DEPRECATED: The URL for the current device manifest. :rtype: str ''' pass @manifest.setter def manifest(self): '''Set value of `manifest` :param value: value to set :type value: str ''' pass @property def manifest_timestamp(self): '''The timestamp of the current manifest version. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def mechanism(self): '''The ID of the channel used to communicate with the device. :rtype: str ''' pass @mechanism.setter def mechanism(self): '''Set value of `mechanism` :param value: value to set :type value: str ''' pass @property def mechanism_url(self): '''The address of the connector to use. :rtype: str ''' pass @mechanism_url.setter def mechanism_url(self): '''Set value of `mechanism_url` :param value: value to set :type value: str ''' pass @property def name(self): '''The name of the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def serial_number(self): '''The serial number of the device. api example: '00000000-0000-0000-0000-000000000000' :rtype: str ''' pass @serial_number.setter def serial_number(self): '''Set value of `serial_number` :param value: value to set :type value: str ''' pass @property def state(self): '''The current state of the device. :rtype: str ''' pass @state.setter def state(self): '''Set value of `state` :param value: value to set :type value: str ''' pass @property def updated_at(self): '''The time the object was updated. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def vendor_id(self): '''The device vendor ID. api example: '00000000-0000-0000-0000-000000000000' :rtype: str ''' pass @vendor_id.setter def vendor_id(self): '''Set value of `vendor_id` :param value: value to set :type value: str ''' pass def add_to_group(self, device_group_id): '''Add a device to a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/add/>`_. :param device_group_id: The ID of the group. :type device_group_id: str :rtype: ''' pass def created_at(self): '''Create a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/>`_. :rtype: Device ''' pass def delete(self): '''Delete a device. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all devices. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/>`_. **API Filters** The following filters are supported by the API when listing Device entities: +---------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========================+======+======+======+======+======+======+======+ | account_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | auto_update | Y | Y | | | | | | +---------------------------+------+------+------+------+------+------+------+ | bootstrap_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | bootstrapped_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | ca_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | connector_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployed_state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployment | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_execution_mode | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_key | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_type | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | enrolment_list_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | firmware_checksum | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | host_gateway | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism_url | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | serial_number | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | vendor_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import Device from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("account_id", "eq", <filter value>) for device in Device().list(filter=api_filter): print(device.account_id) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(Device) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List all devices. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device ''' pass def remove_from_group(self, device_group_id): '''Remove a device from a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/remove/>`_. :param device_group_id: The ID of the group. :type device_group_id: str :rtype: ''' pass def renew_certificate(self, certificate_name): '''Request certificate renewal. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{device-id}/certificates/{certificate-name}/renew>`_. :param certificate_name: The certificate name. :type certificate_name: str :rtype: CertificateEnrollment ''' pass def updated_at(self): '''Update a device `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/devices/{id}/>`_. :rtype: Device ''' pass
113
62
15
3
5
7
2
1.09
1
14
11
0
61
30
61
72
1,102
245
411
189
261
446
239
105
173
22
2
2
98
2,311
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_enrollment.py
mbed_cloud.foundation.entities.devices.device_enrollment.DeviceEnrollment
class DeviceEnrollment(Entity): """Represents the `DeviceEnrollment` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "account_id", "claimed_at", "created_at", "enrolled_device_id", "enrollment_identity", "expires_at", "id", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, expires_at=None, id=None, ): """Creates a local `DeviceEnrollment` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param claimed_at: The time the device was claimed. :type claimed_at: datetime :param created_at: The time of the enrollment identity creation. :type created_at: datetime :param enrolled_device_id: The ID of the device in the Device Directory once it is registered. :type enrolled_device_id: str :param enrollment_identity: (Required) Enrollment identity. :type enrollment_identity: str :param expires_at: The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :type expires_at: datetime :param id: (Required) Enrollment identity. :type id: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._claimed_at = fields.DateTimeField(value=claimed_at) self._created_at = fields.DateTimeField(value=created_at) self._enrolled_device_id = fields.StringField(value=enrolled_device_id) self._enrollment_identity = fields.StringField(value=enrollment_identity) self._expires_at = fields.DateTimeField(value=expires_at) self._id = fields.StringField(value=id) @property def account_id(self): """ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._account_id.value @property def claimed_at(self): """The time the device was claimed. :rtype: datetime """ return self._claimed_at.value @property def created_at(self): """The time of the enrollment identity creation. :rtype: datetime """ return self._created_at.value @property def enrolled_device_id(self): """The ID of the device in the Device Directory once it is registered. api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._enrolled_device_id.value @property def enrollment_identity(self): """Enrollment identity. This field must be set when creating a new DeviceEnrollment Entity. api example: 'A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b: fa:af:4d:2d:73:95:c5' :rtype: str """ return self._enrollment_identity.value @enrollment_identity.setter def enrollment_identity(self, value): """Set value of `enrollment_identity` :param value: value to set :type value: str """ self._enrollment_identity.set(value) @property def expires_at(self): """The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :rtype: datetime """ return self._expires_at.value @property def id(self): """Enrollment identity. This field must be set when updating or deleting an existing DeviceEnrollment Entity. api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) def create(self): """Create a single enrollment. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments>`_. :rtype: DeviceEnrollment """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._enrollment_identity.value_set: body_params["enrollment_identity"] = self._enrollment_identity.to_api() return self._client.call_api( method="post", path="/v3/device-enrollments", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete an enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments/{id}>`_. :rtype: DeviceEnrollment """ return self._client.call_api( method="delete", path="/v3/device-enrollments/{id}", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, ) def list(self, filter=None, order="ASC", max_results=None, page_size=None, include=None): """Get a list of enrollments per account. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: Number of results to return (2-1000). :type page_size: int :param include: Comma-separated additional data to return. Currently supported: total_count. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEnrollment) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import DeviceEnrollment from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=DeviceEnrollment._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = DeviceEnrollment._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=DeviceEnrollment, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order="ASC", limit=None, include=None): """Get a list of enrollments per account. :param after: Entity ID to fetch after. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: Number of results to return (2-1000). :type limit: int :param include: Comma-separated additional data to return. Currently supported: total_count. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.DeviceEnrollmentOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/device-enrollments", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get details of an single enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments/{id}>`_. :rtype: DeviceEnrollment """ return self._client.call_api( method="get", path="/v3/device-enrollments/{id}", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, )
class DeviceEnrollment(Entity): '''Represents the `DeviceEnrollment` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, expires_at=None, id=None, ): '''Creates a local `DeviceEnrollment` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param claimed_at: The time the device was claimed. :type claimed_at: datetime :param created_at: The time of the enrollment identity creation. :type created_at: datetime :param enrolled_device_id: The ID of the device in the Device Directory once it is registered. :type enrolled_device_id: str :param enrollment_identity: (Required) Enrollment identity. :type enrollment_identity: str :param expires_at: The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :type expires_at: datetime :param id: (Required) Enrollment identity. :type id: str ''' pass @property def account_id(self): '''ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @property def claimed_at(self): '''The time the device was claimed. :rtype: datetime ''' pass @property def created_at(self): '''The time of the enrollment identity creation. :rtype: datetime ''' pass @property def enrolled_device_id(self): '''The ID of the device in the Device Directory once it is registered. api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @property def enrollment_identity(self): '''Enrollment identity. This field must be set when creating a new DeviceEnrollment Entity. api example: 'A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b: fa:af:4d:2d:73:95:c5' :rtype: str ''' pass @enrollment_identity.setter def enrollment_identity(self): '''Set value of `enrollment_identity` :param value: value to set :type value: str ''' pass @property def expires_at(self): '''The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :rtype: datetime ''' pass @property def id(self): '''Enrollment identity. This field must be set when updating or deleting an existing DeviceEnrollment Entity. api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass def created_at(self): '''Create a single enrollment. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments>`_. :rtype: DeviceEnrollment ''' pass def delete(self): '''Delete an enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments/{id}>`_. :rtype: DeviceEnrollment ''' pass def list(self, filter=None, order="ASC", max_results=None, page_size=None, include=None): '''Get a list of enrollments per account. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: Number of results to return (2-1000). :type page_size: int :param include: Comma-separated additional data to return. Currently supported: total_count. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEnrollment) ''' pass def _paginate_list(self, after=None, filter=None, order="ASC", limit=None, include=None): '''Get a list of enrollments per account. :param after: Entity ID to fetch after. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: ASC or DESC :type order: str :param limit: Number of results to return (2-1000). :type limit: int :param include: Comma-separated additional data to return. Currently supported: total_count. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get details of an single enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments/{id}>`_. :rtype: DeviceEnrollment ''' pass
25
16
18
4
7
8
1
0.99
1
8
5
0
15
7
15
26
316
77
120
51
82
119
58
32
39
5
2
2
21
2,312
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_enrollment_bulk_create.py
mbed_cloud.foundation.entities.devices.device_enrollment_bulk_create.DeviceEnrollmentBulkCreate
class DeviceEnrollmentBulkCreate(Entity): """Represents the `DeviceEnrollmentBulkCreate` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "account_id", "completed_at", "created_at", "errors_count", "errors_report_file", "full_report_file", "id", "processed_count", "status", "total_count", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): """Creates a local `DeviceEnrollmentBulkCreate` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: (Required) Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._completed_at = fields.DateTimeField(value=completed_at) self._created_at = fields.DateTimeField(value=created_at) self._errors_count = fields.IntegerField(value=errors_count) self._errors_report_file = fields.StringField(value=errors_report_file) self._full_report_file = fields.StringField(value=full_report_file) self._id = fields.StringField(value=id) self._processed_count = fields.IntegerField(value=processed_count) self._status = fields.StringField(value=status, enum=enums.DeviceEnrollmentBulkCreateStatusEnum) self._total_count = fields.IntegerField(value=total_count) @property def account_id(self): """ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._account_id.value @property def completed_at(self): """The time the bulk creation task was completed. Null when creating bulk upload or delete. :rtype: datetime """ return self._completed_at.value @property def created_at(self): """The time of receiving the bulk creation task. :rtype: datetime """ return self._created_at.value @property def errors_count(self): """The number of enrollment identities with failed processing. :rtype: int """ return self._errors_count.value @property def errors_report_file(self): """Link to error report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/errors_report.csv' :rtype: str """ return self._errors_report_file.value @property def full_report_file(self): """Link to full report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/full_report.csv' :rtype: str """ return self._full_report_file.value @property def id(self): """Bulk ID This field must be set when updating or deleting an existing DeviceEnrollmentBulkCreate Entity. :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def processed_count(self): """The number of enrollment identities processed until now. :rtype: int """ return self._processed_count.value @property def status(self): """The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. api example: 'new' :rtype: str """ return self._status.value @property def total_count(self): """Total number of enrollment identities found in the input CSV. api example: 10 :rtype: int """ return self._total_count.value def create(self, enrollment_identities): """Bulk upload. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-uploads>`_. :param enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10 MB. Files can be provided as a file object or a path to an existing file on disk. :type enrollment_identities: file :rtype: DeviceEnrollmentBulkCreate """ auto_close_enrollment_identities = False # If enrollment_identities is a string rather than a file, treat as a path and attempt to open the file. if enrollment_identities and isinstance(enrollment_identities, six.string_types): enrollment_identities = open(enrollment_identities, "rb") auto_close_enrollment_identities = True try: return self._client.call_api( method="post", path="/v3/device-enrollments-bulk-uploads", stream_params={ "enrollment_identities": ("enrollment_identities.csv", enrollment_identities, "text/csv") }, unpack=self, ) finally: # Calling the API may result in an exception being raised so close the files in a finally statement. # Note: Files are only closed if they were opened by the method. if auto_close_enrollment_identities: enrollment_identities.close() def download_errors_report_file(self): """Download the error report file for the created the bulk enrollment. :rtype: file """ from mbed_cloud.foundation._custom_methods import download_errors_report_file return download_errors_report_file(self=self, foreign_key=self.__class__) def download_full_report_file(self): """Download the full report file for the created of the bulk enrollment. :rtype: file """ from mbed_cloud.foundation._custom_methods import download_full_report_file return download_full_report_file(self=self, foreign_key=self.__class__) def read(self): """Get bulk upload entity. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-uploads/{id}>`_. :rtype: DeviceEnrollmentBulkCreate """ return self._client.call_api( method="get", path="/v3/device-enrollments-bulk-uploads/{id}", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, )
class DeviceEnrollmentBulkCreate(Entity): '''Represents the `DeviceEnrollmentBulkCreate` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): '''Creates a local `DeviceEnrollmentBulkCreate` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: (Required) Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int ''' pass @property def account_id(self): '''ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @property def completed_at(self): '''The time the bulk creation task was completed. Null when creating bulk upload or delete. :rtype: datetime ''' pass @property def created_at(self): '''The time of receiving the bulk creation task. :rtype: datetime ''' pass @property def errors_count(self): '''The number of enrollment identities with failed processing. :rtype: int ''' pass @property def errors_report_file(self): '''Link to error report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/errors_report.csv' :rtype: str ''' pass @property def full_report_file(self): '''Link to full report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/full_report.csv' :rtype: str ''' pass @property def id(self): '''Bulk ID This field must be set when updating or deleting an existing DeviceEnrollmentBulkCreate Entity. :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def processed_count(self): '''The number of enrollment identities processed until now. :rtype: int ''' pass @property def status(self): '''The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. api example: 'new' :rtype: str ''' pass @property def total_count(self): '''Total number of enrollment identities found in the input CSV. api example: 10 :rtype: int ''' pass def created_at(self): '''Bulk upload. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-uploads>`_. :param enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10 MB. Files can be provided as a file object or a path to an existing file on disk. :type enrollment_identities: file :rtype: DeviceEnrollmentBulkCreate ''' pass def download_errors_report_file(self): '''Download the error report file for the created the bulk enrollment. :rtype: file ''' pass def download_full_report_file(self): '''Download the full report file for the created of the bulk enrollment. :rtype: file ''' pass def read(self): '''Get bulk upload entity. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-uploads/{id}>`_. :rtype: DeviceEnrollmentBulkCreate ''' pass
28
17
15
3
5
7
1
1.07
1
5
4
0
16
10
16
27
287
70
105
58
62
112
56
34
37
3
2
2
18
2,313
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_enrollment_bulk_delete.py
mbed_cloud.foundation.entities.devices.device_enrollment_bulk_delete.DeviceEnrollmentBulkDelete
class DeviceEnrollmentBulkDelete(Entity): """Represents the `DeviceEnrollmentBulkDelete` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "account_id", "completed_at", "created_at", "errors_count", "errors_report_file", "full_report_file", "id", "processed_count", "status", "total_count", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): """Creates a local `DeviceEnrollmentBulkDelete` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: (Required) Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._completed_at = fields.DateTimeField(value=completed_at) self._created_at = fields.DateTimeField(value=created_at) self._errors_count = fields.IntegerField(value=errors_count) self._errors_report_file = fields.StringField(value=errors_report_file) self._full_report_file = fields.StringField(value=full_report_file) self._id = fields.StringField(value=id) self._processed_count = fields.IntegerField(value=processed_count) self._status = fields.StringField(value=status, enum=enums.DeviceEnrollmentBulkDeleteStatusEnum) self._total_count = fields.IntegerField(value=total_count) @property def account_id(self): """ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._account_id.value @property def completed_at(self): """The time the bulk creation task was completed. Null when creating bulk upload or delete. :rtype: datetime """ return self._completed_at.value @property def created_at(self): """The time of receiving the bulk creation task. :rtype: datetime """ return self._created_at.value @property def errors_count(self): """The number of enrollment identities with failed processing. :rtype: int """ return self._errors_count.value @property def errors_report_file(self): """Link to error report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/errors_report.csv' :rtype: str """ return self._errors_report_file.value @property def full_report_file(self): """Link to full report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/full_report.csv' :rtype: str """ return self._full_report_file.value @property def id(self): """Bulk ID This field must be set when updating or deleting an existing DeviceEnrollmentBulkDelete Entity. :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def processed_count(self): """The number of enrollment identities processed until now. :rtype: int """ return self._processed_count.value @property def status(self): """The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. api example: 'new' :rtype: str """ return self._status.value @property def total_count(self): """Total number of enrollment identities found in the input CSV. api example: 10 :rtype: int """ return self._total_count.value def delete(self, enrollment_identities): """Bulk delete. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-deletes>`_. :param enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. Files can be provided as a file object or a path to an existing file on disk. :type enrollment_identities: file :rtype: DeviceEnrollmentBulkDelete """ auto_close_enrollment_identities = False # If enrollment_identities is a string rather than a file, treat as a path and attempt to open the file. if enrollment_identities and isinstance(enrollment_identities, six.string_types): enrollment_identities = open(enrollment_identities, "rb") auto_close_enrollment_identities = True try: return self._client.call_api( method="post", path="/v3/device-enrollments-bulk-deletes", stream_params={ "enrollment_identities": ("enrollment_identities.csv", enrollment_identities, "text/csv") }, unpack=self, ) finally: # Calling the API may result in an exception being raised so close the files in a finally statement. # Note: Files are only closed if they were opened by the method. if auto_close_enrollment_identities: enrollment_identities.close() def download_errors_report_file(self): """Download the error report file for the bulk enrollment deletion. :rtype: file """ from mbed_cloud.foundation._custom_methods import download_errors_report_file return download_errors_report_file(self=self, foreign_key=self.__class__) def download_full_report_file(self): """Download the full report file for the bulk enrollment deletion. :rtype: file """ from mbed_cloud.foundation._custom_methods import download_full_report_file return download_full_report_file(self=self, foreign_key=self.__class__) def read(self): """Get bulk delete entity. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-deletes/{id}>`_. :rtype: DeviceEnrollmentBulkDelete """ return self._client.call_api( method="get", path="/v3/device-enrollments-bulk-deletes/{id}", content_type="application/json", path_params={"id": self._id.to_api()}, unpack=self, )
class DeviceEnrollmentBulkDelete(Entity): '''Represents the `DeviceEnrollmentBulkDelete` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): '''Creates a local `DeviceEnrollmentBulkDelete` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: (Required) Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int ''' pass @property def account_id(self): '''ID api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @property def completed_at(self): '''The time the bulk creation task was completed. Null when creating bulk upload or delete. :rtype: datetime ''' pass @property def created_at(self): '''The time of receiving the bulk creation task. :rtype: datetime ''' pass @property def errors_count(self): '''The number of enrollment identities with failed processing. :rtype: int ''' pass @property def errors_report_file(self): '''Link to error report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/errors_report.csv' :rtype: str ''' pass @property def full_report_file(self): '''Link to full report file. Null when creating bulk upload or delete. api example: 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk- uploads/2d238a89038b4ddb84699dd36a901063/full_report.csv' :rtype: str ''' pass @property def id(self): '''Bulk ID This field must be set when updating or deleting an existing DeviceEnrollmentBulkDelete Entity. :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def processed_count(self): '''The number of enrollment identities processed until now. :rtype: int ''' pass @property def status(self): '''The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. api example: 'new' :rtype: str ''' pass @property def total_count(self): '''Total number of enrollment identities found in the input CSV. api example: 10 :rtype: int ''' pass def delete(self, enrollment_identities): '''Bulk delete. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-deletes>`_. :param enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. Files can be provided as a file object or a path to an existing file on disk. :type enrollment_identities: file :rtype: DeviceEnrollmentBulkDelete ''' pass def download_errors_report_file(self): '''Download the error report file for the bulk enrollment deletion. :rtype: file ''' pass def download_full_report_file(self): '''Download the full report file for the bulk enrollment deletion. :rtype: file ''' pass def read(self): '''Get bulk delete entity. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollments-bulk-deletes/{id}>`_. :rtype: DeviceEnrollmentBulkDelete ''' pass
28
17
15
3
5
7
1
1.07
1
5
4
0
16
10
16
27
287
70
105
58
62
112
56
34
37
3
2
2
18
2,314
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/security/developer_certificate.py
mbed_cloud.foundation.entities.security.developer_certificate.DeveloperCertificate
class DeveloperCertificate(Entity): """Represents the `DeveloperCertificate` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "account_id", "certificate", "created_at", "description", "developer_private_key", "id", "name", "security_file_content", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {"developer_certificate": "certificate"} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {"certificate": "developer_certificate"} def __init__( self, _client=None, account_id=None, certificate=None, created_at=None, description=None, developer_private_key=None, id=None, name=None, security_file_content=None, ): """Creates a local `DeveloperCertificate` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: Account to which the developer certificate belongs. :type account_id: str :param certificate: PEM-format X.509 developer certificate. :type certificate: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Description for the developer certificate. :type description: str :param developer_private_key: PEM-format developer private key associated with the certificate. :type developer_private_key: str :param id: (Required) ID that uniquely identifies the developer certificate. :type id: str :param name: (Required) Name of the developer certificate. :type name: str :param security_file_content: Content of the `security.c` file flashed to the device to provide security credentials. :type security_file_content: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._certificate = fields.StringField(value=certificate) self._created_at = fields.DateTimeField(value=created_at) self._description = fields.StringField(value=description) self._developer_private_key = fields.StringField(value=developer_private_key) self._id = fields.StringField(value=id) self._name = fields.StringField(value=name) self._security_file_content = fields.StringField(value=security_file_content) @property def account_id(self): """Account to which the developer certificate belongs. :rtype: str """ return self._account_id.value @property def certificate(self): """PEM-format X.509 developer certificate. :rtype: str """ return self._certificate.value @property def created_at(self): """Creation UTC time RFC3339. :rtype: datetime """ return self._created_at.value @property def description(self): """Description for the developer certificate. :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def developer_private_key(self): """PEM-format developer private key associated with the certificate. :rtype: str """ return self._developer_private_key.value @property def id(self): """ID that uniquely identifies the developer certificate. This field must be set when updating or deleting an existing DeveloperCertificate Entity. :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def name(self): """Name of the developer certificate. This field must be set when creating a new DeveloperCertificate Entity. :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def security_file_content(self): """Content of the `security.c` file flashed to the device to provide security credentials. :rtype: str """ return self._security_file_content.value def create(self): """Create a new developer certificate to connect to the bootstrap server. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/developer-certificates>`_. :rtype: DeveloperCertificate """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._description.value_set: body_params["description"] = self._description.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="post", path="/v3/developer-certificates", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete a trusted certificate by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/trusted-certificates/{cert_id}>`_. :rtype: DeveloperCertificate """ return self._client.call_api( method="delete", path="/v3/trusted-certificates/{cert_id}", content_type="application/json", path_params={"cert_id": self._id.to_api()}, unpack=self, ) def get_trusted_certificate_info(self): """Get trusted certificate by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/trusted-certificates/{cert_id}>`_. :rtype: TrustedCertificate """ from mbed_cloud.foundation import TrustedCertificate return self._client.call_api( method="get", path="/v3/trusted-certificates/{cert_id}", content_type="application/json", path_params={"cert_id": self._id.to_api()}, unpack=TrustedCertificate, ) def read(self): """Fetch an existing developer certificate to connect to the bootstrap server. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/developer-certificates/{developerCertificateId}>`_. :rtype: DeveloperCertificate """ return self._client.call_api( method="get", path="/v3/developer-certificates/{developerCertificateId}", content_type="application/json", path_params={"developerCertificateId": self._id.to_api()}, unpack=self, )
class DeveloperCertificate(Entity): '''Represents the `DeveloperCertificate` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, certificate=None, created_at=None, description=None, developer_private_key=None, id=None, name=None, security_file_content=None, ): '''Creates a local `DeveloperCertificate` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: Account to which the developer certificate belongs. :type account_id: str :param certificate: PEM-format X.509 developer certificate. :type certificate: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Description for the developer certificate. :type description: str :param developer_private_key: PEM-format developer private key associated with the certificate. :type developer_private_key: str :param id: (Required) ID that uniquely identifies the developer certificate. :type id: str :param name: (Required) Name of the developer certificate. :type name: str :param security_file_content: Content of the `security.c` file flashed to the device to provide security credentials. :type security_file_content: str ''' pass @property def account_id(self): '''Account to which the developer certificate belongs. :rtype: str ''' pass @property def certificate(self): '''PEM-format X.509 developer certificate. :rtype: str ''' pass @property def created_at(self): '''Creation UTC time RFC3339. :rtype: datetime ''' pass @property def description(self): '''Description for the developer certificate. :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def developer_private_key(self): '''PEM-format developer private key associated with the certificate. :rtype: str ''' pass @property def id(self): '''ID that uniquely identifies the developer certificate. This field must be set when updating or deleting an existing DeveloperCertificate Entity. :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def name(self): '''Name of the developer certificate. This field must be set when creating a new DeveloperCertificate Entity. :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def security_file_content(self): '''Content of the `security.c` file flashed to the device to provide security credentials. :rtype: str ''' pass def created_at(self): '''Create a new developer certificate to connect to the bootstrap server. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/developer-certificates>`_. :rtype: DeveloperCertificate ''' pass def delete(self): '''Delete a trusted certificate by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/trusted-certificates/{cert_id}>`_. :rtype: DeveloperCertificate ''' pass def get_trusted_certificate_info(self): '''Get trusted certificate by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/trusted-certificates/{cert_id}>`_. :rtype: TrustedCertificate ''' pass def read(self): '''Fetch an existing developer certificate to connect to the bootstrap server. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/developer-certificates/{developerCertificateId}>`_. :rtype: DeveloperCertificate ''' pass
28
17
13
3
5
5
1
0.83
1
4
3
0
16
8
16
27
258
64
106
53
66
88
51
31
33
3
2
1
18
2,315
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_enrollment_denial.py
mbed_cloud.foundation.entities.devices.device_enrollment_denial.DeviceEnrollmentDenial
class DeviceEnrollmentDenial(Entity): """Represents the `DeviceEnrollmentDenial` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = ["account_id", "created_at", "endpoint_name", "id", "trusted_certificate_id"] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, account_id=None, created_at=None, endpoint_name=None, id=None, trusted_certificate_id=None ): """Creates a local `DeviceEnrollmentDenial` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: account id :type account_id: str :param created_at: date on which the failed bootstrap was attempted on :type created_at: datetime :param endpoint_name: endpoint name :type endpoint_name: str :param id: id of the recorded failed bootstrap attempt :type id: str :param trusted_certificate_id: Trusted certificate id :type trusted_certificate_id: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._account_id = fields.StringField(value=account_id) self._created_at = fields.DateTimeField(value=created_at) self._endpoint_name = fields.StringField(value=endpoint_name) self._id = fields.StringField(value=id) self._trusted_certificate_id = fields.StringField(value=trusted_certificate_id) @property def account_id(self): """account id api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._account_id.value @property def created_at(self): """date on which the failed bootstrap was attempted on api example: '2000-01-23T04:56:07.000+00:00' :rtype: datetime """ return self._created_at.value @property def endpoint_name(self): """endpoint name api example: 'Endpoint_1234' :rtype: str """ return self._endpoint_name.value @property def id(self): """id of the recorded failed bootstrap attempt api example: '00005a4e027f0a580a04567c00000000' :rtype: str """ return self._id.value @property def trusted_certificate_id(self): """Trusted certificate id api example: '00005a4e027f0a580a01081c00000000' :rtype: str """ return self._trusted_certificate_id.value def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Return list of devices which were denied to bootstrap due to being subjected to blacklisting. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollment-denials>`_. **API Filters** The following filters are supported by the API when listing DeviceEnrollmentDenial entities: +------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +========================+======+======+======+======+======+======+======+ | endpoint_name | Y | | | | | | | +------------------------+------+------+------+------+------+------+------+ | trusted_certificate_id | Y | | | | | | | +------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceEnrollmentDenial from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("endpoint_name", "eq", <filter value>) for device_enrollment_denial in DeviceEnrollmentDenial().list(filter=api_filter): print(device_enrollment_denial.endpoint_name) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Optional parameter for pagination. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: Optional parameter for pagination. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEnrollmentDenial) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import DeviceEnrollmentDenial from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=DeviceEnrollmentDenial._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = DeviceEnrollmentDenial._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=DeviceEnrollmentDenial, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """Return list of devices which were denied to bootstrap due to being subjected to blacklisting. :param after: Optional parameter for pagination. Denied device ID. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Optional parameter for pagination. :type order: str :param limit: Optional parameter for pagination. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.DeviceEnrollmentDenialOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/device-enrollment-denials", content_type="application/json", query_params=query_params, unpack=False, ) def read(self, device_enrollment_denial_id): """Query for a single device by ID `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollment-denials/{device_enrollment_denial_id}>`_. :param device_enrollment_denial_id: id of the recorded failed bootstrap attempt :type device_enrollment_denial_id: str :rtype: DeviceEnrollmentDenial """ return self._client.call_api( method="get", path="/v3/device-enrollment-denials/{device_enrollment_denial_id}", content_type="application/json", path_params={"device_enrollment_denial_id": fields.StringField(device_enrollment_denial_id).to_api()}, unpack=self, )
class DeviceEnrollmentDenial(Entity): '''Represents the `DeviceEnrollmentDenial` entity in Pelion Device Management''' def __init__( self, _client=None, account_id=None, created_at=None, endpoint_name=None, id=None, trusted_certificate_id=None ): '''Creates a local `DeviceEnrollmentDenial` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param account_id: account id :type account_id: str :param created_at: date on which the failed bootstrap was attempted on :type created_at: datetime :param endpoint_name: endpoint name :type endpoint_name: str :param id: id of the recorded failed bootstrap attempt :type id: str :param trusted_certificate_id: Trusted certificate id :type trusted_certificate_id: str ''' pass @property def account_id(self): '''account id api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass @property def created_at(self): '''date on which the failed bootstrap was attempted on api example: '2000-01-23T04:56:07.000+00:00' :rtype: datetime ''' pass @property def endpoint_name(self): '''endpoint name api example: 'Endpoint_1234' :rtype: str ''' pass @property def id(self): '''id of the recorded failed bootstrap attempt api example: '00005a4e027f0a580a04567c00000000' :rtype: str ''' pass @property def trusted_certificate_id(self): '''Trusted certificate id api example: '00005a4e027f0a580a01081c00000000' :rtype: str ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Return list of devices which were denied to bootstrap due to being subjected to blacklisting. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollment-denials>`_. **API Filters** The following filters are supported by the API when listing DeviceEnrollmentDenial entities: +------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +========================+======+======+======+======+======+======+======+ | endpoint_name | Y | | | | | | | +------------------------+------+------+------+------+------+------+------+ | trusted_certificate_id | Y | | | | | | | +------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceEnrollmentDenial from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("endpoint_name", "eq", <filter value>) for device_enrollment_denial in DeviceEnrollmentDenial().list(filter=api_filter): print(device_enrollment_denial.endpoint_name) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Optional parameter for pagination. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: Optional parameter for pagination. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEnrollmentDenial) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''Return list of devices which were denied to bootstrap due to being subjected to blacklisting. :param after: Optional parameter for pagination. Denied device ID. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Optional parameter for pagination. :type order: str :param limit: Optional parameter for pagination. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self, device_enrollment_denial_id): '''Query for a single device by ID `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-enrollment-denials/{device_enrollment_denial_id}>`_. :param device_enrollment_denial_id: id of the recorded failed bootstrap attempt :type device_enrollment_denial_id: str :rtype: DeviceEnrollmentDenial ''' pass
15
10
23
6
7
11
2
1.44
1
8
5
0
9
5
9
20
236
63
71
30
51
102
41
23
28
5
2
2
14
2,316
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_group.py
mbed_cloud.foundation.entities.devices.device_group.DeviceGroup
class DeviceGroup(Entity): """Represents the `DeviceGroup` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = ["created_at", "custom_attributes", "description", "devices_count", "id", "name", "updated_at"] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, created_at=None, custom_attributes=None, description=None, devices_count=None, id=None, name=None, updated_at=None, ): """Creates a local `DeviceGroup` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the campaign was created. :type created_at: datetime :param custom_attributes: Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param description: The description of the group. :type description: str :param devices_count: The number of devices in this group. :type devices_count: int :param id: (Required) The group ID. :type id: str :param name: Name of the group. :type name: str :param updated_at: The time the object was updated. :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._created_at = fields.DateTimeField(value=created_at) self._custom_attributes = fields.DictField(value=custom_attributes) self._description = fields.StringField(value=description) self._devices_count = fields.IntegerField(value=devices_count) self._id = fields.StringField(value=id) self._name = fields.StringField(value=name) self._updated_at = fields.DateTimeField(value=updated_at) @property def created_at(self): """The time the campaign was created. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def custom_attributes(self): """Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. api example: {'key': 'value'} :rtype: dict """ return self._custom_attributes.value @custom_attributes.setter def custom_attributes(self, value): """Set value of `custom_attributes` :param value: value to set :type value: dict """ self._custom_attributes.set(value) @property def description(self): """The description of the group. api example: 'Devices on the factory floor.' :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def devices_count(self): """The number of devices in this group. api example: 10 :rtype: int """ return self._devices_count.value @property def id(self): """The group ID. This field must be set when updating or deleting an existing DeviceGroup Entity. api example: '015c3029f6f7000000000001001000c3' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def name(self): """Name of the group. api example: 'My devices' :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) @property def updated_at(self): """The time the object was updated. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._updated_at.value def add_device(self, device_id=None): """Add a device to a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/add/>`_. :param device_id: No description available :type device_id: str :rtype: """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} # Method parameters are unconditionally sent even if set to None body_params["device_id"] = fields.StringField(device_id).to_api() return self._client.call_api( method="post", path="/v3/device-groups/{device-group-id}/devices/add/", content_type="application/json", body_params=body_params, path_params={"device-group-id": self._id.to_api()}, unpack=self, ) def create(self): """Create a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/>`_. :rtype: DeviceGroup """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._custom_attributes.value_set: body_params["custom_attributes"] = self._custom_attributes.to_api() if self._description.value_set: body_params["description"] = self._description.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="post", path="/v3/device-groups/", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup """ return self._client.call_api( method="delete", path="/v3/device-groups/{device-group-id}/", content_type="application/json", path_params={"device-group-id": self._id.to_api()}, unpack=self, ) def devices(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get a page of devices `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/>`_. **API Filters** The following filters are supported by the API when listing DeviceGroup entities: +---------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========================+======+======+======+======+======+======+======+ | account_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | auto_update | Y | Y | | | | | | +---------------------------+------+------+------+------+------+------+------+ | bootstrap_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | bootstrapped_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | ca_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | connector_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployed_state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployment | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_execution_mode | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_key | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_type | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | enrolment_list_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | firmware_checksum | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | host_gateway | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism_url | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | serial_number | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | vendor_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceGroup from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("account_id", "eq", <filter value>) for device in DeviceGroup().devices(filter=api_filter): print(device.account_id) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(Device) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import Device from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=Device._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = Device._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=Device, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_devices, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all groups. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/>`_. **API Filters** The following filters are supported by the API when listing DeviceGroup entities: +---------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===============+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | devices_count | Y | Y | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceGroup from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for device_group in DeviceGroup().list(filter=api_filter): print(device_group.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceGroup) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import DeviceGroup from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=DeviceGroup._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = DeviceGroup._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=DeviceGroup, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_devices(self, after=None, filter=None, order=None, limit=None, include=None): """Get a page of devices :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/device-groups/{device-group-id}/devices/", content_type="application/json", query_params=query_params, path_params={"device-group-id": self._id.to_api()}, unpack=False, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List all groups. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/device-groups/", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get a group. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup """ return self._client.call_api( method="get", path="/v3/device-groups/{device-group-id}/", content_type="application/json", path_params={"device-group-id": self._id.to_api()}, unpack=self, ) def remove_device(self, device_id=None): """Remove a device from a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/remove/>`_. :param device_id: No description available :type device_id: str :rtype: """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} # Method parameters are unconditionally sent even if set to None body_params["device_id"] = fields.StringField(device_id).to_api() return self._client.call_api( method="post", path="/v3/device-groups/{device-group-id}/devices/remove/", content_type="application/json", body_params=body_params, path_params={"device-group-id": self._id.to_api()}, unpack=self, ) def update(self): """Modify the attributes of a group. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._custom_attributes.value_set: body_params["custom_attributes"] = self._custom_attributes.to_api() if self._description.value_set: body_params["description"] = self._description.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="put", path="/v3/device-groups/{device-group-id}/", content_type="application/json", body_params=body_params, path_params={"device-group-id": self._id.to_api()}, unpack=self, )
class DeviceGroup(Entity): '''Represents the `DeviceGroup` entity in Pelion Device Management''' def __init__( self, _client=None, created_at=None, custom_attributes=None, description=None, devices_count=None, id=None, name=None, updated_at=None, ): '''Creates a local `DeviceGroup` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: The time the campaign was created. :type created_at: datetime :param custom_attributes: Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param description: The description of the group. :type description: str :param devices_count: The number of devices in this group. :type devices_count: int :param id: (Required) The group ID. :type id: str :param name: Name of the group. :type name: str :param updated_at: The time the object was updated. :type updated_at: datetime ''' pass @property def created_at(self): '''The time the campaign was created. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def custom_attributes(self): '''Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. api example: {'key': 'value'} :rtype: dict ''' pass @custom_attributes.setter def custom_attributes(self): '''Set value of `custom_attributes` :param value: value to set :type value: dict ''' pass @property def description(self): '''The description of the group. api example: 'Devices on the factory floor.' :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def devices_count(self): '''The number of devices in this group. api example: 10 :rtype: int ''' pass @property def id(self): '''The group ID. This field must be set when updating or deleting an existing DeviceGroup Entity. api example: '015c3029f6f7000000000001001000c3' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def name(self): '''Name of the group. api example: 'My devices' :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass @property def updated_at(self): '''The time the object was updated. api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass def add_device(self, device_id=None): '''Add a device to a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/add/>`_. :param device_id: No description available :type device_id: str :rtype: ''' pass def created_at(self): '''Create a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/>`_. :rtype: DeviceGroup ''' pass def delete(self): '''Delete a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup ''' pass def devices_count(self): '''Get a page of devices `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/>`_. **API Filters** The following filters are supported by the API when listing DeviceGroup entities: +---------------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===========================+======+======+======+======+======+======+======+ | account_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | auto_update | Y | Y | | | | | | +---------------------------+------+------+------+------+------+------+------+ | bootstrap_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | bootstrapped_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | ca_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | connector_expiration_date | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployed_state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | deployment | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_class | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_execution_mode | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | device_key | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | endpoint_type | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | enrolment_list_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | firmware_checksum | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | host_gateway | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | manifest_timestamp | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | mechanism_url | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | serial_number | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | state | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ | vendor_id | Y | Y | | | Y | Y | | +---------------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceGroup from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("account_id", "eq", <filter value>) for device in DeviceGroup().devices(filter=api_filter): print(device.account_id) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(Device) ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all groups. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/>`_. **API Filters** The following filters are supported by the API when listing DeviceGroup entities: +---------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +===============+======+======+======+======+======+======+======+ | created_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | devices_count | Y | Y | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | name | Y | Y | | | Y | Y | | +---------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | Y | Y | | +---------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceGroup from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("created_at", "in", <filter value>) for device_group in DeviceGroup().list(filter=api_filter): print(device_group.created_at) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceGroup) ''' pass def _paginate_devices(self, after=None, filter=None, order=None, limit=None, include=None): '''Get a page of devices :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List all groups. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count`. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a group. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup ''' pass def remove_device(self, device_id=None): '''Remove a device from a group `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/devices/remove/>`_. :param device_id: No description available :type device_id: str :rtype: ''' pass def updated_at(self): '''Modify the attributes of a group. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-groups/{device-group-id}/>`_. :rtype: DeviceGroup ''' pass
34
23
26
5
8
13
2
1.5
1
9
6
0
22
7
22
33
624
136
195
67
145
293
100
46
71
5
2
2
38
2,317
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceDeployedStateEnum
class DeviceDeployedStateEnum(BaseEnum): """Represents expected values of `DeviceDeployedStateEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ DEVELOPMENT = "development" PRODUCTION = "production" values = frozenset(("development", "production"))
class DeviceDeployedStateEnum(BaseEnum): '''Represents expected values of `DeviceDeployedStateEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,318
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceEnrollmentBulkCreateStatusEnum
class DeviceEnrollmentBulkCreateStatusEnum(BaseEnum): """Represents expected values of `DeviceEnrollmentBulkCreateStatusEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ COMPLETED = "completed" NEW = "new" PROCESSING = "processing" values = frozenset(("completed", "new", "processing"))
class DeviceEnrollmentBulkCreateStatusEnum(BaseEnum): '''Represents expected values of `DeviceEnrollmentBulkCreateStatusEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.2
1
0
0
0
0
0
0
1
15
4
5
5
4
6
5
5
4
0
2
0
0
2,319
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceEnrollmentBulkDeleteStatusEnum
class DeviceEnrollmentBulkDeleteStatusEnum(BaseEnum): """Represents expected values of `DeviceEnrollmentBulkDeleteStatusEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ COMPLETED = "completed" NEW = "new" PROCESSING = "processing" values = frozenset(("completed", "new", "processing"))
class DeviceEnrollmentBulkDeleteStatusEnum(BaseEnum): '''Represents expected values of `DeviceEnrollmentBulkDeleteStatusEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.2
1
0
0
0
0
0
0
1
15
4
5
5
4
6
5
5
4
0
2
0
0
2,320
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceEnrollmentDenialOrderEnum
class DeviceEnrollmentDenialOrderEnum(BaseEnum): """Represents expected values of `DeviceEnrollmentDenialOrderEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ ASC = "ASC" DESC = "DESC" values = frozenset(("ASC", "DESC"))
class DeviceEnrollmentDenialOrderEnum(BaseEnum): '''Represents expected values of `DeviceEnrollmentDenialOrderEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,321
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceEnrollmentOrderEnum
class DeviceEnrollmentOrderEnum(BaseEnum): """Represents expected values of `DeviceEnrollmentOrderEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ ASC = "ASC" DESC = "DESC" values = frozenset(("ASC", "DESC"))
class DeviceEnrollmentOrderEnum(BaseEnum): '''Represents expected values of `DeviceEnrollmentOrderEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,322
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceMechanismEnum
class DeviceMechanismEnum(BaseEnum): """Represents expected values of `DeviceMechanismEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ CONNECTOR = "connector" DIRECT = "direct" values = frozenset(("connector", "direct"))
class DeviceMechanismEnum(BaseEnum): '''Represents expected values of `DeviceMechanismEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
1.5
1
0
0
0
0
0
0
1
14
4
4
4
3
6
4
4
3
0
2
0
0
2,323
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/enums.py
mbed_cloud.foundation.entities.devices.enums.DeviceStateEnum
class DeviceStateEnum(BaseEnum): """Represents expected values of `DeviceStateEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. """ BOOTSTRAPPED = "bootstrapped" CLOUD_ENROLLING = "cloud_enrolling" DEREGISTERED = "deregistered" REGISTERED = "registered" UNENROLLED = "unenrolled" values = frozenset(("bootstrapped", "cloud_enrolling", "deregistered", "registered", "unenrolled"))
class DeviceStateEnum(BaseEnum): '''Represents expected values of `DeviceStateEnum` This is used by Entities in the "devices" category. .. note:: If new values are added to the enum in the API they will be passed through unchanged by the SDK, but will not be on this list. If this occurs please update the SDK to the most recent version. '''
1
1
0
0
0
0
0
0.86
1
0
0
0
0
0
0
1
17
4
7
7
6
6
7
7
6
0
2
0
0
2,324
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/entity_factory.py
mbed_cloud.foundation.entities.entity_factory.EntityFactory
class EntityFactory: """Creates instances of Foundation Entities using the shared SDK context.""" def __init__(self, client): """EntityFactory takes a client to attach to the models it creates""" self._client = client def account( self, address_line1=None, address_line2=None, admin_email=None, admin_full_name=None, admin_id=None, admin_key=None, admin_name=None, admin_password=None, aliases=None, city=None, company=None, contact=None, contract_number=None, country=None, created_at=None, custom_fields=None, customer_number=None, display_name=None, email=None, end_market=None, expiration=None, expiration_warning_threshold=None, id=None, idle_timeout=None, limits=None, mfa_status=None, notification_emails=None, parent_account=None, parent_id=None, password_policy=None, password_recovery_expiration=None, phone_number=None, policies=None, postal_code=None, reason=None, reference_note=None, sales_contact=None, state=None, status=None, template_id=None, tier=None, updated_at=None, upgraded_at=None, ): """Creates a local `Account` instance, using the shared SDK context. :param address_line1: Postal address line 1. :type address_line1: str :param address_line2: Postal address line 2. :type address_line2: str :param admin_email: The email address of the admin user created for this account. Present only in the response for account creation. :type admin_email: str :param admin_full_name: The full name of the admin user created for this account. Present only in the response for account creation. :type admin_full_name: str :param admin_id: The ID of the admin user created for this account. :type admin_id: str :param admin_key: The admin API key created for this account. Present only in the response for account creation. :type admin_key: str :param admin_name: The username of the admin user created for this account. Present only in the response for account creation. :type admin_name: str :param admin_password: The password of the admin user created for this account. Present only in the response for account creation. :type admin_password: str :param aliases: An array of aliases. :type aliases: list :param city: The city part of the postal address. :type city: str :param company: The name of the company. :type company: str :param contact: The name of the contact person for this account. :type contact: str :param contract_number: Contract number of the customer. :type contract_number: str :param country: The country part of the postal address. :type country: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param custom_fields: Account's custom properties as key-value pairs. :type custom_fields: dict :param customer_number: Customer number of the customer. :type customer_number: str :param display_name: The display name for the account. :type display_name: str :param email: The company email address for this account. :type email: str :param end_market: Account end market. :type end_market: str :param expiration: Expiration time of the account, as UTC time RFC3339. :type expiration: datetime :param expiration_warning_threshold: Indicates how many days (1-180) before account expiration a notification email is sent. :type expiration_warning_threshold: int :param id: Account ID. :type id: str :param idle_timeout: The reference token expiration time, in minutes, for this account. :type idle_timeout: int :param limits: List of limits as key-value pairs if requested. :type limits: dict :param mfa_status: The enforcement status of multi-factor authentication, either `enforced` or `optional`. :type mfa_status: str :param notification_emails: A list of notification email addresses. :type notification_emails: list :param parent_account: Represents parent account contact details in responses. :type parent_account: dict :param parent_id: The ID of the parent account, if any. :type parent_id: str :param password_policy: The password policy for this account. :type password_policy: dict :param password_recovery_expiration: Indicates for how many minutes a password recovery email is valid. :type password_recovery_expiration: int :param phone_number: The phone number of a company representative. :type phone_number: str :param policies: List of policies if requested. :type policies: list :param postal_code: The postal code part of the postal address. :type postal_code: str :param reason: A note with the reason for account status update. :type reason: str :param reference_note: A reference note for updating the status of the account. :type reference_note: str :param sales_contact: Email address of the sales contact. :type sales_contact: str :param state: The state part of the postal address. :type state: str :param status: The status of the account. :type status: str :param template_id: Account template ID. :type template_id: str :param tier: The tier level of the account; `0`: free tier, `1`: commercial account, `2`: partner tier. Other values are reserved for the future. :type tier: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param upgraded_at: Time when upgraded to commercial account in UTC format RFC3339. :type upgraded_at: datetime :return: A new instance of a Account Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.account.Account """ from mbed_cloud.foundation import Account return Account( _client=self._client, address_line1=address_line1, address_line2=address_line2, admin_email=admin_email, admin_full_name=admin_full_name, admin_id=admin_id, admin_key=admin_key, admin_name=admin_name, admin_password=admin_password, aliases=aliases, city=city, company=company, contact=contact, contract_number=contract_number, country=country, created_at=created_at, custom_fields=custom_fields, customer_number=customer_number, display_name=display_name, email=email, end_market=end_market, expiration=expiration, expiration_warning_threshold=expiration_warning_threshold, id=id, idle_timeout=idle_timeout, limits=limits, mfa_status=mfa_status, notification_emails=notification_emails, parent_account=parent_account, parent_id=parent_id, password_policy=password_policy, password_recovery_expiration=password_recovery_expiration, phone_number=phone_number, policies=policies, postal_code=postal_code, reason=reason, reference_note=reference_note, sales_contact=sales_contact, state=state, status=status, template_id=template_id, tier=tier, updated_at=updated_at, upgraded_at=upgraded_at, ) def active_session(self, account_id=None, ip_address=None, login_time=None, reference_token=None, user_agent=None): """Creates a local `ActiveSession` instance, using the shared SDK context. :param account_id: The UUID of the account. :type account_id: str :param ip_address: IP address of the client. :type ip_address: str :param login_time: The login time of the user. :type login_time: datetime :param reference_token: The reference token. :type reference_token: str :param user_agent: User Agent header from the login request. :type user_agent: str :return: A new instance of a ActiveSession Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.active_session.ActiveSession """ from mbed_cloud.foundation import ActiveSession return ActiveSession( _client=self._client, account_id=account_id, ip_address=ip_address, login_time=login_time, reference_token=reference_token, user_agent=user_agent, ) def api_key( self, account_id=None, created_at=None, creation_time=None, id=None, key=None, last_login_time=None, name=None, owner=None, status=None, updated_at=None, ): """Creates a local `ApiKey` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: The timestamp of the API key creation in the storage, in milliseconds. :type creation_time: int :param id: The ID of the API key. :type id: str :param key: The API key. :type key: str :param last_login_time: The timestamp of the latest API key usage, in milliseconds. :type last_login_time: int :param name: The display name for the API key. :type name: str :param owner: The owner of this API key, who is the creator by default. :type owner: str :param status: The status of the API key. :type status: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a ApiKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.api_key.ApiKey """ from mbed_cloud.foundation import ApiKey return ApiKey( _client=self._client, account_id=account_id, created_at=created_at, creation_time=creation_time, id=id, key=key, last_login_time=last_login_time, name=name, owner=owner, status=status, updated_at=updated_at, ) def campaign_device_metadata( self, campaign_id=None, created_at=None, deployment_state=None, description=None, device_id=None, id=None, mechanism=None, mechanism_url=None, name=None, updated_at=None, ): """Creates a local `CampaignDeviceMetadata` instance, using the shared SDK context. :param campaign_id: The device's campaign ID :type campaign_id: str :param created_at: The time the campaign was created :type created_at: datetime :param deployment_state: The state of the update campaign on the device :type deployment_state: str :param description: Description :type description: str :param device_id: The device ID :type device_id: str :param id: The metadata record ID :type id: str :param mechanism: How the firmware is delivered (connector or direct) :type mechanism: str :param mechanism_url: The Device Management Connect URL :type mechanism_url: str :param name: The record name :type name: str :param updated_at: The record was modified in the database format: date-time :type updated_at: datetime :return: A new instance of a CampaignDeviceMetadata Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_device_metadata.CampaignDeviceMetadata """ from mbed_cloud.foundation import CampaignDeviceMetadata return CampaignDeviceMetadata( _client=self._client, campaign_id=campaign_id, created_at=created_at, deployment_state=deployment_state, description=description, device_id=device_id, id=id, mechanism=mechanism, mechanism_url=mechanism_url, name=name, updated_at=updated_at, ) def campaign_statistics(self, campaign_id=None, count=None, created_at=None, id=None, summary_status=None): """Creates a local `CampaignStatistics` instance, using the shared SDK context. :param campaign_id: ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param id: ID of the event type description :type id: str :param summary_status: The event type description. :type summary_status: str :return: A new instance of a CampaignStatistics Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_statistics.CampaignStatistics """ from mbed_cloud.foundation import CampaignStatistics return CampaignStatistics( _client=self._client, campaign_id=campaign_id, count=count, created_at=created_at, id=id, summary_status=summary_status, ) def campaign_statistics_events( self, campaign_id=None, count=None, created_at=None, description=None, event_type=None, id=None, summary_status=None, summary_status_id=None, ): """Creates a local `CampaignStatisticsEvents` instance, using the shared SDK context. :param campaign_id: ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param description: :type description: str :param event_type: :type event_type: str :param id: :type id: str :param summary_status: :type summary_status: str :param summary_status_id: :type summary_status_id: str :return: A new instance of a CampaignStatisticsEvents Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_statistics_events.CampaignStatisticsEvents """ from mbed_cloud.foundation import CampaignStatisticsEvents return CampaignStatisticsEvents( _client=self._client, campaign_id=campaign_id, count=count, created_at=created_at, description=description, event_type=event_type, id=id, summary_status=summary_status, summary_status_id=summary_status_id, ) def certificate_enrollment( self, certificate_name=None, created_at=None, device_id=None, enroll_result=None, enroll_result_detail=None, enroll_status=None, id=None, updated_at=None, ): """Creates a local `CertificateEnrollment` instance, using the shared SDK context. :param certificate_name: The certificate name. :type certificate_name: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param device_id: The device ID. :type device_id: str :param enroll_result: The result of certificate enrollment request. :type enroll_result: str :param enroll_result_detail: Additional information in case of failure. :type enroll_result_detail: str :param enroll_status: The status of certificate enrollment request. :type enroll_status: str :param id: The certificate enrollment ID. :type id: str :param updated_at: Update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a CertificateEnrollment Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_enrollment.CertificateEnrollment """ from mbed_cloud.foundation import CertificateEnrollment return CertificateEnrollment( _client=self._client, certificate_name=certificate_name, created_at=created_at, device_id=device_id, enroll_result=enroll_result, enroll_result_detail=enroll_result_detail, enroll_status=enroll_status, id=id, updated_at=updated_at, ) def certificate_issuer( self, created_at=None, description=None, id=None, issuer_attributes=None, issuer_type=None, name=None ): """Creates a local `CertificateIssuer` instance, using the shared SDK context. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: General description for the certificate issuer. :type description: str :param id: The ID of the certificate issuer. :type id: str :param issuer_attributes: General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :type issuer_attributes: dict :param issuer_type: The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. :type issuer_type: str :param name: Certificate issuer name, unique per account. :type name: str :return: A new instance of a CertificateIssuer Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_issuer.CertificateIssuer """ from mbed_cloud.foundation import CertificateIssuer return CertificateIssuer( _client=self._client, created_at=created_at, description=description, id=id, issuer_attributes=issuer_attributes, issuer_type=issuer_type, name=name, ) def certificate_issuer_config( self, certificate_issuer_id=None, created_at=None, id=None, reference=None, updated_at=None ): """Creates a local `CertificateIssuerConfig` instance, using the shared SDK context. :param certificate_issuer_id: The ID of the certificate issuer. Null if Device Management internal HSM is used. :type certificate_issuer_id: str :param created_at: Created UTC time RFC3339. :type created_at: datetime :param id: The ID of the certificate issuer configuration. :type id: str :param reference: The certificate name to which the certificate issuer configuration applies. :type reference: str :param updated_at: Updated UTC time RFC3339. :type updated_at: datetime :return: A new instance of a CertificateIssuerConfig Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_issuer_config.CertificateIssuerConfig """ from mbed_cloud.foundation import CertificateIssuerConfig return CertificateIssuerConfig( _client=self._client, certificate_issuer_id=certificate_issuer_id, created_at=created_at, id=id, reference=reference, updated_at=updated_at, ) def dark_theme_color(self, color=None, reference=None, updated_at=None): """Creates a local `DarkThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a DarkThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.dark_theme_color.DarkThemeColor """ from mbed_cloud.foundation import DarkThemeColor return DarkThemeColor(_client=self._client, color=color, reference=reference, updated_at=updated_at) def dark_theme_image(self, reference=None, static_uri=None, updated_at=None): """Creates a local `DarkThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a DarkThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.dark_theme_image.DarkThemeImage """ from mbed_cloud.foundation import DarkThemeImage return DarkThemeImage(_client=self._client, reference=reference, static_uri=static_uri, updated_at=updated_at) def developer_certificate( self, account_id=None, certificate=None, created_at=None, description=None, developer_private_key=None, id=None, name=None, security_file_content=None, ): """Creates a local `DeveloperCertificate` instance, using the shared SDK context. :param account_id: Account to which the developer certificate belongs. :type account_id: str :param certificate: PEM-format X.509 developer certificate. :type certificate: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Description for the developer certificate. :type description: str :param developer_private_key: PEM-format developer private key associated with the certificate. :type developer_private_key: str :param id: ID that uniquely identifies the developer certificate. :type id: str :param name: Name of the developer certificate. :type name: str :param security_file_content: Content of the `security.c` file flashed to the device to provide security credentials. :type security_file_content: str :return: A new instance of a DeveloperCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.developer_certificate.DeveloperCertificate """ from mbed_cloud.foundation import DeveloperCertificate return DeveloperCertificate( _client=self._client, account_id=account_id, certificate=certificate, created_at=created_at, description=description, developer_private_key=developer_private_key, id=id, name=name, security_file_content=security_file_content, ) def device( self, account_id=None, auto_update=None, bootstrap_expiration_date=None, bootstrapped_timestamp=None, ca_id=None, connector_expiration_date=None, created_at=None, custom_attributes=None, deployed_state=None, deployment=None, description=None, device_class=None, device_execution_mode=None, device_key=None, endpoint_name=None, endpoint_type=None, enrolment_list_timestamp=None, firmware_checksum=None, host_gateway=None, id=None, issuer_fingerprint=None, manifest=None, manifest_timestamp=None, mechanism=None, mechanism_url=None, name=None, serial_number=None, state=None, updated_at=None, vendor_id=None, ): """Creates a local `Device` instance, using the shared SDK context. :param account_id: The ID of the associated account. :type account_id: str :param auto_update: DEPRECATED: Mark this device for automatic firmware update. :type auto_update: bool :param bootstrap_expiration_date: The expiration date of the certificate used to connect to bootstrap server. :type bootstrap_expiration_date: date :param bootstrapped_timestamp: The timestamp of the device's most recent bootstrap process. :type bootstrapped_timestamp: datetime :param ca_id: The certificate issuer's ID. :type ca_id: str :param connector_expiration_date: The expiration date of the certificate used to connect to LwM2M server. :type connector_expiration_date: date :param created_at: The timestamp of when the device was created in the device directory. :type created_at: datetime :param custom_attributes: Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param deployed_state: DEPRECATED: The state of the device's deployment. :type deployed_state: str :param deployment: DEPRECATED: The last deployment used on the device. :type deployment: str :param description: The description of the device. :type description: str :param device_class: An ID representing the model and hardware revision of the device. :type device_class: str :param device_execution_mode: The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :type device_execution_mode: int :param device_key: The fingerprint of the device certificate. :type device_key: str :param endpoint_name: The endpoint name given to the device. :type endpoint_name: str :param endpoint_type: The endpoint type of the device. For example, the device is a gateway. :type endpoint_type: str :param enrolment_list_timestamp: The claim date/time. :type enrolment_list_timestamp: datetime :param firmware_checksum: The SHA256 checksum of the current firmware image. :type firmware_checksum: str :param host_gateway: The ID of the host gateway, if appropriate. :type host_gateway: str :param id: The ID of the device. The device ID is used across all Device Management APIs. :type id: str :param issuer_fingerprint: SHA256 fingerprint of the certificate used to validate the signature of the device certificate. :type issuer_fingerprint: str :param manifest: DEPRECATED: The URL for the current device manifest. :type manifest: str :param manifest_timestamp: The timestamp of the current manifest version. :type manifest_timestamp: datetime :param mechanism: The ID of the channel used to communicate with the device. :type mechanism: str :param mechanism_url: The address of the connector to use. :type mechanism_url: str :param name: The name of the device. :type name: str :param serial_number: The serial number of the device. :type serial_number: str :param state: The current state of the device. :type state: str :param updated_at: The time the object was updated. :type updated_at: datetime :param vendor_id: The device vendor ID. :type vendor_id: str :return: A new instance of a Device Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device.Device """ from mbed_cloud.foundation import Device return Device( _client=self._client, account_id=account_id, auto_update=auto_update, bootstrap_expiration_date=bootstrap_expiration_date, bootstrapped_timestamp=bootstrapped_timestamp, ca_id=ca_id, connector_expiration_date=connector_expiration_date, created_at=created_at, custom_attributes=custom_attributes, deployed_state=deployed_state, deployment=deployment, description=description, device_class=device_class, device_execution_mode=device_execution_mode, device_key=device_key, endpoint_name=endpoint_name, endpoint_type=endpoint_type, enrolment_list_timestamp=enrolment_list_timestamp, firmware_checksum=firmware_checksum, host_gateway=host_gateway, id=id, issuer_fingerprint=issuer_fingerprint, manifest=manifest, manifest_timestamp=manifest_timestamp, mechanism=mechanism, mechanism_url=mechanism_url, name=name, serial_number=serial_number, state=state, updated_at=updated_at, vendor_id=vendor_id, ) def device_enrollment( self, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, expires_at=None, id=None, ): """Creates a local `DeviceEnrollment` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param claimed_at: The time the device was claimed. :type claimed_at: datetime :param created_at: The time of the enrollment identity creation. :type created_at: datetime :param enrolled_device_id: The ID of the device in the Device Directory once it is registered. :type enrolled_device_id: str :param enrollment_identity: Enrollment identity. :type enrollment_identity: str :param expires_at: The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :type expires_at: datetime :param id: Enrollment identity. :type id: str :return: A new instance of a DeviceEnrollment Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment.DeviceEnrollment """ from mbed_cloud.foundation import DeviceEnrollment return DeviceEnrollment( _client=self._client, account_id=account_id, claimed_at=claimed_at, created_at=created_at, enrolled_device_id=enrolled_device_id, enrollment_identity=enrollment_identity, expires_at=expires_at, id=id, ) def device_enrollment_bulk_create( self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): """Creates a local `DeviceEnrollmentBulkCreate` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int :return: A new instance of a DeviceEnrollmentBulkCreate Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_bulk_create.DeviceEnrollmentBulkCreate """ from mbed_cloud.foundation import DeviceEnrollmentBulkCreate return DeviceEnrollmentBulkCreate( _client=self._client, account_id=account_id, completed_at=completed_at, created_at=created_at, errors_count=errors_count, errors_report_file=errors_report_file, full_report_file=full_report_file, id=id, processed_count=processed_count, status=status, total_count=total_count, ) def device_enrollment_bulk_delete( self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): """Creates a local `DeviceEnrollmentBulkDelete` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int :return: A new instance of a DeviceEnrollmentBulkDelete Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_bulk_delete.DeviceEnrollmentBulkDelete """ from mbed_cloud.foundation import DeviceEnrollmentBulkDelete return DeviceEnrollmentBulkDelete( _client=self._client, account_id=account_id, completed_at=completed_at, created_at=created_at, errors_count=errors_count, errors_report_file=errors_report_file, full_report_file=full_report_file, id=id, processed_count=processed_count, status=status, total_count=total_count, ) def device_enrollment_denial( self, account_id=None, created_at=None, endpoint_name=None, id=None, trusted_certificate_id=None ): """Creates a local `DeviceEnrollmentDenial` instance, using the shared SDK context. :param account_id: account id :type account_id: str :param created_at: date on which the failed bootstrap was attempted on :type created_at: datetime :param endpoint_name: endpoint name :type endpoint_name: str :param id: id of the recorded failed bootstrap attempt :type id: str :param trusted_certificate_id: Trusted certificate id :type trusted_certificate_id: str :return: A new instance of a DeviceEnrollmentDenial Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_denial.DeviceEnrollmentDenial """ from mbed_cloud.foundation import DeviceEnrollmentDenial return DeviceEnrollmentDenial( _client=self._client, account_id=account_id, created_at=created_at, endpoint_name=endpoint_name, id=id, trusted_certificate_id=trusted_certificate_id, ) def device_events( self, changes=None, created_at=None, data=None, date_time=None, description=None, device_id=None, event_type=None, event_type_category=None, event_type_description=None, id=None, state_change=None, ): """Creates a local `DeviceEvents` instance, using the shared SDK context. :param changes: :type changes: dict :param created_at: :type created_at: datetime :param data: Additional data relevant to the event. :type data: dict :param date_time: :type date_time: datetime :param description: :type description: str :param device_id: :type device_id: str :param event_type: Event code :type event_type: str :param event_type_category: Category code which groups the event type by a summary category. :type event_type_category: str :param event_type_description: Generic description of the event :type event_type_description: str :param id: :type id: str :param state_change: :type state_change: bool :return: A new instance of a DeviceEvents Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_events.DeviceEvents """ from mbed_cloud.foundation import DeviceEvents return DeviceEvents( _client=self._client, changes=changes, created_at=created_at, data=data, date_time=date_time, description=description, device_id=device_id, event_type=event_type, event_type_category=event_type_category, event_type_description=event_type_description, id=id, state_change=state_change, ) def device_group( self, created_at=None, custom_attributes=None, description=None, devices_count=None, id=None, name=None, updated_at=None, ): """Creates a local `DeviceGroup` instance, using the shared SDK context. :param created_at: The time the campaign was created. :type created_at: datetime :param custom_attributes: Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param description: The description of the group. :type description: str :param devices_count: The number of devices in this group. :type devices_count: int :param id: The group ID. :type id: str :param name: Name of the group. :type name: str :param updated_at: The time the object was updated. :type updated_at: datetime :return: A new instance of a DeviceGroup Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_group.DeviceGroup """ from mbed_cloud.foundation import DeviceGroup return DeviceGroup( _client=self._client, created_at=created_at, custom_attributes=custom_attributes, description=description, devices_count=devices_count, id=id, name=name, updated_at=updated_at, ) def firmware_image( self, created_at=None, datafile_checksum=None, datafile_size=None, datafile_url=None, description=None, id=None, name=None, updated_at=None, ): """Creates a local `FirmwareImage` instance, using the shared SDK context. :param created_at: The time the object was created :type created_at: datetime :param datafile_checksum: The checksum (sha256) generated for the datafile :type datafile_checksum: str :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The firmware image file URL :type datafile_url: str :param description: The description of the object :type description: str :param id: The firmware image ID :type id: str :param name: The firmware image name :type name: str :param updated_at: The time the object was updated :type updated_at: datetime :return: A new instance of a FirmwareImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.firmware_image.FirmwareImage """ from mbed_cloud.foundation import FirmwareImage return FirmwareImage( _client=self._client, created_at=created_at, datafile_checksum=datafile_checksum, datafile_size=datafile_size, datafile_url=datafile_url, description=description, id=id, name=name, updated_at=updated_at, ) def firmware_manifest( self, created_at=None, datafile_size=None, datafile_url=None, description=None, device_class=None, id=None, key_table_url=None, name=None, timestamp=None, updated_at=None, ): """Creates a local `FirmwareManifest` instance, using the shared SDK context. :param created_at: The time the object was created :type created_at: datetime :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The URL of the firmware manifest binary :type datafile_url: str :param description: The description of the firmware manifest :type description: str :param device_class: The class of the device :type device_class: str :param id: The firmware manifest ID :type id: str :param key_table_url: The key table of pre-shared keys for devices :type key_table_url: str :param name: The name of the object :type name: str :param timestamp: The firmware manifest version as a timestamp :type timestamp: datetime :param updated_at: The time the object was updated :type updated_at: datetime :return: A new instance of a FirmwareManifest Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.firmware_manifest.FirmwareManifest """ from mbed_cloud.foundation import FirmwareManifest return FirmwareManifest( _client=self._client, created_at=created_at, datafile_size=datafile_size, datafile_url=datafile_url, description=description, device_class=device_class, id=id, key_table_url=key_table_url, name=name, timestamp=timestamp, updated_at=updated_at, ) def light_theme_color(self, color=None, reference=None, updated_at=None): """Creates a local `LightThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a LightThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.light_theme_color.LightThemeColor """ from mbed_cloud.foundation import LightThemeColor return LightThemeColor(_client=self._client, color=color, reference=reference, updated_at=updated_at) def light_theme_image(self, reference=None, static_uri=None, updated_at=None): """Creates a local `LightThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a LightThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.light_theme_image.LightThemeImage """ from mbed_cloud.foundation import LightThemeImage return LightThemeImage(_client=self._client, reference=reference, static_uri=static_uri, updated_at=updated_at) def login_history(self, date=None, ip_address=None, success=None, user_agent=None): """Creates a local `LoginHistory` instance, using the shared SDK context. :param date: UTC time RFC3339 for this login attempt. :type date: datetime :param ip_address: IP address of the client. :type ip_address: str :param success: Flag indicating whether login attempt was successful or not. :type success: bool :param user_agent: User Agent header from the login request. :type user_agent: str :return: A new instance of a LoginHistory Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.login_history.LoginHistory """ from mbed_cloud.foundation import LoginHistory return LoginHistory( _client=self._client, date=date, ip_address=ip_address, success=success, user_agent=user_agent ) def login_profile(self, id=None, name=None): """Creates a local `LoginProfile` instance, using the shared SDK context. :param id: ID of the identity provider. :type id: str :param name: Name of the identity provider. :type name: str :return: A new instance of a LoginProfile Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.login_profile.LoginProfile """ from mbed_cloud.foundation import LoginProfile return LoginProfile(_client=self._client, id=id, name=name) def parent_account(self, admin_email=None, admin_name=None, id=None): """Creates a local `ParentAccount` instance, using the shared SDK context. :param admin_email: The email address of the admin user who is the contact person of the parent account. :type admin_email: str :param admin_name: The name of the admin user who is the contact person of the parent account. :type admin_name: str :param id: The ID of the parent account. :type id: str :return: A new instance of a ParentAccount Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.parent_account.ParentAccount """ from mbed_cloud.foundation import ParentAccount return ParentAccount(_client=self._client, admin_email=admin_email, admin_name=admin_name, id=id) def password_policy(self, minimum_length=None): """Creates a local `PasswordPolicy` instance, using the shared SDK context. :param minimum_length: Minimum length for the password. :type minimum_length: int :return: A new instance of a PasswordPolicy Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.password_policy.PasswordPolicy """ from mbed_cloud.foundation import PasswordPolicy return PasswordPolicy(_client=self._client, minimum_length=minimum_length) def policy(self, action=None, allow=None, feature=None, inherited=None, resource=None): """Creates a local `Policy` instance, using the shared SDK context. :param action: Comma-separated list of actions, empty string represents all actions. :type action: str :param allow: True or false controlling whether an action is allowed or not. :type allow: bool :param feature: Feature name corresponding to this policy. :type feature: str :param inherited: Flag indicating whether this feature is inherited or overwritten specifically. :type inherited: bool :param resource: Resource that is protected by this policy. :type resource: str :return: A new instance of a Policy Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.policy.Policy """ from mbed_cloud.foundation import Policy return Policy( _client=self._client, action=action, allow=allow, feature=feature, inherited=inherited, resource=resource ) def pre_shared_key(self, created_at=None, endpoint_name=None, id=None): """Creates a local `PreSharedKey` instance, using the shared SDK context. :param created_at: The date-time (RFC3339) when this PSK was uploaded to Device Management. :type created_at: datetime :param endpoint_name: The unique endpoint identifier that this PSK applies to. 16-64 [pr intable](https://en.wikipedia.org/wiki/ASCII#Printable_characters) (non-control) ASCII characters. :type endpoint_name: str :param id: The Id of the pre_shared_key, shadows the endpoint_name :type id: str :return: A new instance of a PreSharedKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.pre_shared_key.PreSharedKey """ from mbed_cloud.foundation import PreSharedKey return PreSharedKey(_client=self._client, created_at=created_at, endpoint_name=endpoint_name, id=id) def server_credentials(self, created_at=None, id=None, server_certificate=None, server_uri=None): """Creates a local `ServerCredentials` instance, using the shared SDK context. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param id: Unique entity ID. :type id: str :param server_certificate: PEM-format X.509 server certificate used to validate the server certificate received during the TLS/DTLS handshake. :type server_certificate: str :param server_uri: Server URI that the client connects to. :type server_uri: str :return: A new instance of a ServerCredentials Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.server_credentials.ServerCredentials """ from mbed_cloud.foundation import ServerCredentials return ServerCredentials( _client=self._client, created_at=created_at, id=id, server_certificate=server_certificate, server_uri=server_uri, ) def subtenant_api_key( self, account_id=None, created_at=None, creation_time=None, id=None, key=None, last_login_time=None, name=None, owner=None, status=None, updated_at=None, ): """Creates a local `SubtenantApiKey` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: The timestamp of the API key creation in the storage, in milliseconds. :type creation_time: int :param id: The ID of the API key. :type id: str :param key: The API key. :type key: str :param last_login_time: The timestamp of the latest API key usage, in milliseconds. :type last_login_time: int :param name: The display name for the API key. :type name: str :param owner: The owner of this API key, who is the creator by default. :type owner: str :param status: The status of the API key. :type status: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a SubtenantApiKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_api_key.SubtenantApiKey """ from mbed_cloud.foundation import SubtenantApiKey return SubtenantApiKey( _client=self._client, account_id=account_id, created_at=created_at, creation_time=creation_time, id=id, key=key, last_login_time=last_login_time, name=name, owner=owner, status=status, updated_at=updated_at, ) def subtenant_dark_theme_color(self, color=None, reference=None, updated_at=None): """Creates a local `SubtenantDarkThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantDarkThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_dark_theme_color.SubtenantDarkThemeColor """ from mbed_cloud.foundation import SubtenantDarkThemeColor return SubtenantDarkThemeColor(_client=self._client, color=color, reference=reference, updated_at=updated_at) def subtenant_dark_theme_image(self, reference=None, static_uri=None, updated_at=None): """Creates a local `SubtenantDarkThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantDarkThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_dark_theme_image.SubtenantDarkThemeImage """ from mbed_cloud.foundation import SubtenantDarkThemeImage return SubtenantDarkThemeImage( _client=self._client, reference=reference, static_uri=static_uri, updated_at=updated_at ) def subtenant_light_theme_color(self, color=None, reference=None, updated_at=None): """Creates a local `SubtenantLightThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantLightThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_light_theme_color.SubtenantLightThemeColor """ from mbed_cloud.foundation import SubtenantLightThemeColor return SubtenantLightThemeColor(_client=self._client, color=color, reference=reference, updated_at=updated_at) def subtenant_light_theme_image(self, reference=None, static_uri=None, updated_at=None): """Creates a local `SubtenantLightThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantLightThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_light_theme_image.SubtenantLightThemeImage """ from mbed_cloud.foundation import SubtenantLightThemeImage return SubtenantLightThemeImage( _client=self._client, reference=reference, static_uri=static_uri, updated_at=updated_at ) def subtenant_trusted_certificate( self, account_id=None, certificate=None, certificate_fingerprint=None, created_at=None, description=None, device_execution_mode=None, enrollment_mode=None, id=None, is_developer_certificate=None, issuer=None, name=None, owner_id=None, service=None, status=None, subject=None, updated_at=None, valid=None, validity=None, ): """Creates a local `SubtenantTrustedCertificate` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param certificate: X509.v3 trusted certificate in PEM format. :type certificate: str :param certificate_fingerprint: A SHA-256 fingerprint of the certificate. :type certificate_fingerprint: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Human readable description of this certificate. :type description: str :param device_execution_mode: Device execution mode where 1 means a developer certificate. :type device_execution_mode: int :param enrollment_mode: If true, signature is not required. Default value false. :type enrollment_mode: bool :param id: Entity ID. :type id: str :param is_developer_certificate: Whether or not this certificate is a developer certificate. :type is_developer_certificate: bool :param issuer: Issuer of the certificate. :type issuer: str :param name: Certificate name. :type name: str :param owner_id: The ID of the owner. :type owner_id: str :param service: Service name where the certificate is used. :type service: str :param status: Status of the certificate. :type status: str :param subject: Subject of the certificate. :type subject: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param valid: This read-only flag indicates whether the certificate is valid or not. :type valid: bool :param validity: Expiration time in UTC formatted as RFC3339. :type validity: datetime :return: A new instance of a SubtenantTrustedCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.subtenant_trusted_certificate.SubtenantTrustedCertificate """ from mbed_cloud.foundation import SubtenantTrustedCertificate return SubtenantTrustedCertificate( _client=self._client, account_id=account_id, certificate=certificate, certificate_fingerprint=certificate_fingerprint, created_at=created_at, description=description, device_execution_mode=device_execution_mode, enrollment_mode=enrollment_mode, id=id, is_developer_certificate=is_developer_certificate, issuer=issuer, name=name, owner_id=owner_id, service=service, status=status, subject=subject, updated_at=updated_at, valid=valid, validity=validity, ) def subtenant_user( self, account_id=None, active_sessions=None, address=None, created_at=None, creation_time=None, custom_fields=None, email=None, email_verified=None, full_name=None, id=None, is_gtc_accepted=None, is_marketing_accepted=None, is_totp_enabled=None, last_login_time=None, login_history=None, login_profiles=None, password=None, password_changed_time=None, phone_number=None, status=None, totp_scratch_codes=None, updated_at=None, username=None, ): """Creates a local `SubtenantUser` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param active_sessions: List of active user sessions. :type active_sessions: list :param address: Address. :type address: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: A timestamp of the user creation in the storage, in milliseconds. :type creation_time: int :param custom_fields: User's account-specific custom properties. The value is a string. :type custom_fields: dict :param email: The email address. :type email: str :param email_verified: A flag indicating whether the user's email address has been verified or not. :type email_verified: bool :param full_name: The full name of the user. :type full_name: str :param id: The ID of the user. :type id: str :param is_gtc_accepted: A flag indicating that the user has accepted General Terms and Conditions. :type is_gtc_accepted: bool :param is_marketing_accepted: A flag indicating that the user has consented to receive marketing information. :type is_marketing_accepted: bool :param is_totp_enabled: A flag indicating whether two-factor authentication (TOTP) has been enabled. :type is_totp_enabled: bool :param last_login_time: A timestamp of the latest login of the user, in milliseconds. :type last_login_time: int :param login_history: Timestamps, succeedings, IP addresses and user agent information of the last five logins of the user, with timestamps in RFC3339 format. :type login_history: list :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param password: The password when creating a new user. It will be generated when not present in the request. :type password: str :param password_changed_time: A timestamp of the latest change of the user password, in milliseconds. :type password_changed_time: int :param phone_number: Phone number. :type phone_number: str :param status: The status of the user. ENROLLING state indicates that the user is in the middle of the enrollment process. INVITED means that the user has not accepted the invitation request. RESET means that the password must be changed immediately. INACTIVE users are locked out and not permitted to use the system. :type status: str :param totp_scratch_codes: A list of scratch codes for the two-factor authentication. Visible only when 2FA is requested to be enabled or the codes regenerated. :type totp_scratch_codes: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param username: A username. :type username: str :return: A new instance of a SubtenantUser Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_user.SubtenantUser """ from mbed_cloud.foundation import SubtenantUser return SubtenantUser( _client=self._client, account_id=account_id, active_sessions=active_sessions, address=address, created_at=created_at, creation_time=creation_time, custom_fields=custom_fields, email=email, email_verified=email_verified, full_name=full_name, id=id, is_gtc_accepted=is_gtc_accepted, is_marketing_accepted=is_marketing_accepted, is_totp_enabled=is_totp_enabled, last_login_time=last_login_time, login_history=login_history, login_profiles=login_profiles, password=password, password_changed_time=password_changed_time, phone_number=phone_number, status=status, totp_scratch_codes=totp_scratch_codes, updated_at=updated_at, username=username, ) def subtenant_user_invitation( self, account_id=None, created_at=None, email=None, expiration=None, id=None, login_profiles=None, updated_at=None, user_id=None, ): """Creates a local `SubtenantUserInvitation` instance, using the shared SDK context. :param account_id: The ID of the account the user is invited to. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param email: Email address of the invited user. :type email: str :param expiration: Invitation expiration as UTC time RFC3339. :type expiration: datetime :param id: The ID of the invitation. :type id: str :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param user_id: The ID of the invited user. :type user_id: str :return: A new instance of a SubtenantUserInvitation Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_user_invitation.SubtenantUserInvitation """ from mbed_cloud.foundation import SubtenantUserInvitation return SubtenantUserInvitation( _client=self._client, account_id=account_id, created_at=created_at, email=email, expiration=expiration, id=id, login_profiles=login_profiles, updated_at=updated_at, user_id=user_id, ) def trusted_certificate( self, account_id=None, certificate=None, certificate_fingerprint=None, created_at=None, description=None, device_execution_mode=None, enrollment_mode=None, id=None, is_developer_certificate=None, issuer=None, name=None, owner_id=None, service=None, status=None, subject=None, updated_at=None, valid=None, validity=None, ): """Creates a local `TrustedCertificate` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param certificate: X509.v3 trusted certificate in PEM format. :type certificate: str :param certificate_fingerprint: A SHA-256 fingerprint of the certificate. :type certificate_fingerprint: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Human readable description of this certificate. :type description: str :param device_execution_mode: Device execution mode where 1 means a developer certificate. :type device_execution_mode: int :param enrollment_mode: If true, signature is not required. Default value false. :type enrollment_mode: bool :param id: Entity ID. :type id: str :param is_developer_certificate: Whether or not this certificate is a developer certificate. :type is_developer_certificate: bool :param issuer: Issuer of the certificate. :type issuer: str :param name: Certificate name. :type name: str :param owner_id: The ID of the owner. :type owner_id: str :param service: Service name where the certificate is used. :type service: str :param status: Status of the certificate. :type status: str :param subject: Subject of the certificate. :type subject: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param valid: This read-only flag indicates whether the certificate is valid or not. :type valid: bool :param validity: Expiration time in UTC formatted as RFC3339. :type validity: datetime :return: A new instance of a TrustedCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.trusted_certificate.TrustedCertificate """ from mbed_cloud.foundation import TrustedCertificate return TrustedCertificate( _client=self._client, account_id=account_id, certificate=certificate, certificate_fingerprint=certificate_fingerprint, created_at=created_at, description=description, device_execution_mode=device_execution_mode, enrollment_mode=enrollment_mode, id=id, is_developer_certificate=is_developer_certificate, issuer=issuer, name=name, owner_id=owner_id, service=service, status=status, subject=subject, updated_at=updated_at, valid=valid, validity=validity, ) def update_campaign( self, autostop_reason=None, created_at=None, description=None, device_filter=None, device_filter_helper=None, finished=None, id=None, name=None, phase=None, root_manifest_id=None, root_manifest_url=None, started_at=None, updated_at=None, when=None, ): """Creates a local `UpdateCampaign` instance, using the shared SDK context. :param autostop_reason: Text description of why a campaign failed to start or why a campaign stopped. :type autostop_reason: str :param created_at: The time the update campaign was created :type created_at: datetime :param description: An optional description of the campaign :type description: str :param device_filter: The filter for the devices the campaign is targeting at :type device_filter: str :param device_filter_helper: Helper for creating the device filter string. :type device_filter_helper: mbed_cloud.client.api_filter.ApiFilter :param finished: The campaign finish timestamp :type finished: datetime :param id: The campaign ID :type id: str :param name: The campaign name :type name: str :param phase: The current phase of the campaign. :type phase: str :param root_manifest_id: :type root_manifest_id: str :param root_manifest_url: :type root_manifest_url: str :param started_at: :type started_at: datetime :param updated_at: The time the object was updated :type updated_at: datetime :param when: The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. :type when: datetime :return: A new instance of a UpdateCampaign Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.update_campaign.UpdateCampaign """ from mbed_cloud.foundation import UpdateCampaign return UpdateCampaign( _client=self._client, autostop_reason=autostop_reason, created_at=created_at, description=description, device_filter=device_filter, device_filter_helper=device_filter_helper, finished=finished, id=id, name=name, phase=phase, root_manifest_id=root_manifest_id, root_manifest_url=root_manifest_url, started_at=started_at, updated_at=updated_at, when=when, ) def user( self, account_id=None, active_sessions=None, address=None, created_at=None, creation_time=None, custom_fields=None, email=None, email_verified=None, full_name=None, id=None, is_gtc_accepted=None, is_marketing_accepted=None, is_totp_enabled=None, last_login_time=None, login_history=None, login_profiles=None, password=None, password_changed_time=None, phone_number=None, status=None, totp_scratch_codes=None, updated_at=None, username=None, ): """Creates a local `User` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param active_sessions: List of active user sessions. :type active_sessions: list :param address: Address. :type address: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: A timestamp of the user creation in the storage, in milliseconds. :type creation_time: int :param custom_fields: User's account-specific custom properties. The value is a string. :type custom_fields: dict :param email: The email address. :type email: str :param email_verified: A flag indicating whether the user's email address has been verified or not. :type email_verified: bool :param full_name: The full name of the user. :type full_name: str :param id: The ID of the user. :type id: str :param is_gtc_accepted: A flag indicating that the user has accepted General Terms and Conditions. :type is_gtc_accepted: bool :param is_marketing_accepted: A flag indicating that the user has consented to receive marketing information. :type is_marketing_accepted: bool :param is_totp_enabled: A flag indicating whether two-factor authentication (TOTP) has been enabled. :type is_totp_enabled: bool :param last_login_time: A timestamp of the latest login of the user, in milliseconds. :type last_login_time: int :param login_history: Timestamps, succeedings, IP addresses and user agent information of the last five logins of the user, with timestamps in RFC3339 format. :type login_history: list :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param password: The password when creating a new user. It will be generated when not present in the request. :type password: str :param password_changed_time: A timestamp of the latest change of the user password, in milliseconds. :type password_changed_time: int :param phone_number: Phone number. :type phone_number: str :param status: The status of the user. ENROLLING state indicates that the user is in the middle of the enrollment process. INVITED means that the user has not accepted the invitation request. RESET means that the password must be changed immediately. INACTIVE users are locked out and not permitted to use the system. :type status: str :param totp_scratch_codes: A list of scratch codes for the two-factor authentication. Visible only when 2FA is requested to be enabled or the codes regenerated. :type totp_scratch_codes: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param username: A username. :type username: str :return: A new instance of a User Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.user.User """ from mbed_cloud.foundation import User return User( _client=self._client, account_id=account_id, active_sessions=active_sessions, address=address, created_at=created_at, creation_time=creation_time, custom_fields=custom_fields, email=email, email_verified=email_verified, full_name=full_name, id=id, is_gtc_accepted=is_gtc_accepted, is_marketing_accepted=is_marketing_accepted, is_totp_enabled=is_totp_enabled, last_login_time=last_login_time, login_history=login_history, login_profiles=login_profiles, password=password, password_changed_time=password_changed_time, phone_number=phone_number, status=status, totp_scratch_codes=totp_scratch_codes, updated_at=updated_at, username=username, ) def user_invitation( self, account_id=None, created_at=None, email=None, expiration=None, id=None, login_profiles=None, updated_at=None, user_id=None, ): """Creates a local `UserInvitation` instance, using the shared SDK context. :param account_id: The ID of the account the user is invited to. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param email: Email address of the invited user. :type email: str :param expiration: Invitation expiration as UTC time RFC3339. :type expiration: datetime :param id: The ID of the invitation. :type id: str :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param user_id: The ID of the invited user. :type user_id: str :return: A new instance of a UserInvitation Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.user_invitation.UserInvitation """ from mbed_cloud.foundation import UserInvitation return UserInvitation( _client=self._client, account_id=account_id, created_at=created_at, email=email, expiration=expiration, id=id, login_profiles=login_profiles, updated_at=updated_at, user_id=user_id, ) def verification_response(self, message=None, successful=None): """Creates a local `VerificationResponse` instance, using the shared SDK context. :param message: Provides details in case of failure. :type message: str :param successful: Indicates whether the certificate issuer was verified successfully. :type successful: bool :return: A new instance of a VerificationResponse Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.verification_response.VerificationResponse """ from mbed_cloud.foundation import VerificationResponse return VerificationResponse(_client=self._client, message=message, successful=successful)
class EntityFactory: '''Creates instances of Foundation Entities using the shared SDK context.''' def __init__(self, client): '''EntityFactory takes a client to attach to the models it creates''' pass def account( self, address_line1=None, address_line2=None, admin_email=None, admin_full_name=None, admin_id=None, admin_key=None, admin_name=None, admin_password=None, aliases=None, city=None, company=None, contact=None, contract_number=None, country=None, created_at=None, custom_fields=None, customer_number=None, display_name=None, email=None, end_market=None, expiration=None, expiration_warning_threshold=None, id=None, idle_timeout=None, limits=None, mfa_status=None, notification_emails=None, parent_account=None, parent_id=None, password_policy=None, password_recovery_expiration=None, phone_number=None, policies=None, postal_code=None, reason=None, reference_note=None, sales_contact=None, state=None, status=None, template_id=None, tier=None, updated_at=None, upgraded_at=None, ): '''Creates a local `Account` instance, using the shared SDK context. :param address_line1: Postal address line 1. :type address_line1: str :param address_line2: Postal address line 2. :type address_line2: str :param admin_email: The email address of the admin user created for this account. Present only in the response for account creation. :type admin_email: str :param admin_full_name: The full name of the admin user created for this account. Present only in the response for account creation. :type admin_full_name: str :param admin_id: The ID of the admin user created for this account. :type admin_id: str :param admin_key: The admin API key created for this account. Present only in the response for account creation. :type admin_key: str :param admin_name: The username of the admin user created for this account. Present only in the response for account creation. :type admin_name: str :param admin_password: The password of the admin user created for this account. Present only in the response for account creation. :type admin_password: str :param aliases: An array of aliases. :type aliases: list :param city: The city part of the postal address. :type city: str :param company: The name of the company. :type company: str :param contact: The name of the contact person for this account. :type contact: str :param contract_number: Contract number of the customer. :type contract_number: str :param country: The country part of the postal address. :type country: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param custom_fields: Account's custom properties as key-value pairs. :type custom_fields: dict :param customer_number: Customer number of the customer. :type customer_number: str :param display_name: The display name for the account. :type display_name: str :param email: The company email address for this account. :type email: str :param end_market: Account end market. :type end_market: str :param expiration: Expiration time of the account, as UTC time RFC3339. :type expiration: datetime :param expiration_warning_threshold: Indicates how many days (1-180) before account expiration a notification email is sent. :type expiration_warning_threshold: int :param id: Account ID. :type id: str :param idle_timeout: The reference token expiration time, in minutes, for this account. :type idle_timeout: int :param limits: List of limits as key-value pairs if requested. :type limits: dict :param mfa_status: The enforcement status of multi-factor authentication, either `enforced` or `optional`. :type mfa_status: str :param notification_emails: A list of notification email addresses. :type notification_emails: list :param parent_account: Represents parent account contact details in responses. :type parent_account: dict :param parent_id: The ID of the parent account, if any. :type parent_id: str :param password_policy: The password policy for this account. :type password_policy: dict :param password_recovery_expiration: Indicates for how many minutes a password recovery email is valid. :type password_recovery_expiration: int :param phone_number: The phone number of a company representative. :type phone_number: str :param policies: List of policies if requested. :type policies: list :param postal_code: The postal code part of the postal address. :type postal_code: str :param reason: A note with the reason for account status update. :type reason: str :param reference_note: A reference note for updating the status of the account. :type reference_note: str :param sales_contact: Email address of the sales contact. :type sales_contact: str :param state: The state part of the postal address. :type state: str :param status: The status of the account. :type status: str :param template_id: Account template ID. :type template_id: str :param tier: The tier level of the account; `0`: free tier, `1`: commercial account, `2`: partner tier. Other values are reserved for the future. :type tier: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param upgraded_at: Time when upgraded to commercial account in UTC format RFC3339. :type upgraded_at: datetime :return: A new instance of a Account Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.account.Account ''' pass def active_session(self, account_id=None, ip_address=None, login_time=None, reference_token=None, user_agent=None): '''Creates a local `ActiveSession` instance, using the shared SDK context. :param account_id: The UUID of the account. :type account_id: str :param ip_address: IP address of the client. :type ip_address: str :param login_time: The login time of the user. :type login_time: datetime :param reference_token: The reference token. :type reference_token: str :param user_agent: User Agent header from the login request. :type user_agent: str :return: A new instance of a ActiveSession Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.active_session.ActiveSession ''' pass def api_key( self, account_id=None, created_at=None, creation_time=None, id=None, key=None, last_login_time=None, name=None, owner=None, status=None, updated_at=None, ): '''Creates a local `ApiKey` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: The timestamp of the API key creation in the storage, in milliseconds. :type creation_time: int :param id: The ID of the API key. :type id: str :param key: The API key. :type key: str :param last_login_time: The timestamp of the latest API key usage, in milliseconds. :type last_login_time: int :param name: The display name for the API key. :type name: str :param owner: The owner of this API key, who is the creator by default. :type owner: str :param status: The status of the API key. :type status: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a ApiKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.api_key.ApiKey ''' pass def campaign_device_metadata( self, campaign_id=None, created_at=None, deployment_state=None, description=None, device_id=None, id=None, mechanism=None, mechanism_url=None, name=None, updated_at=None, ): '''Creates a local `CampaignDeviceMetadata` instance, using the shared SDK context. :param campaign_id: The device's campaign ID :type campaign_id: str :param created_at: The time the campaign was created :type created_at: datetime :param deployment_state: The state of the update campaign on the device :type deployment_state: str :param description: Description :type description: str :param device_id: The device ID :type device_id: str :param id: The metadata record ID :type id: str :param mechanism: How the firmware is delivered (connector or direct) :type mechanism: str :param mechanism_url: The Device Management Connect URL :type mechanism_url: str :param name: The record name :type name: str :param updated_at: The record was modified in the database format: date-time :type updated_at: datetime :return: A new instance of a CampaignDeviceMetadata Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_device_metadata.CampaignDeviceMetadata ''' pass def campaign_statistics(self, campaign_id=None, count=None, created_at=None, id=None, summary_status=None): '''Creates a local `CampaignStatistics` instance, using the shared SDK context. :param campaign_id: ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param id: ID of the event type description :type id: str :param summary_status: The event type description. :type summary_status: str :return: A new instance of a CampaignStatistics Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_statistics.CampaignStatistics ''' pass def campaign_statistics_events( self, campaign_id=None, count=None, created_at=None, description=None, event_type=None, id=None, summary_status=None, summary_status_id=None, ): '''Creates a local `CampaignStatisticsEvents` instance, using the shared SDK context. :param campaign_id: ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param description: :type description: str :param event_type: :type event_type: str :param id: :type id: str :param summary_status: :type summary_status: str :param summary_status_id: :type summary_status_id: str :return: A new instance of a CampaignStatisticsEvents Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.campaign_statistics_events.CampaignStatisticsEvents ''' pass def certificate_enrollment( self, certificate_name=None, created_at=None, device_id=None, enroll_result=None, enroll_result_detail=None, enroll_status=None, id=None, updated_at=None, ): '''Creates a local `CertificateEnrollment` instance, using the shared SDK context. :param certificate_name: The certificate name. :type certificate_name: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param device_id: The device ID. :type device_id: str :param enroll_result: The result of certificate enrollment request. :type enroll_result: str :param enroll_result_detail: Additional information in case of failure. :type enroll_result_detail: str :param enroll_status: The status of certificate enrollment request. :type enroll_status: str :param id: The certificate enrollment ID. :type id: str :param updated_at: Update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a CertificateEnrollment Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_enrollment.CertificateEnrollment ''' pass def certificate_issuer( self, created_at=None, description=None, id=None, issuer_attributes=None, issuer_type=None, name=None ): '''Creates a local `CertificateIssuer` instance, using the shared SDK context. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: General description for the certificate issuer. :type description: str :param id: The ID of the certificate issuer. :type id: str :param issuer_attributes: General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :type issuer_attributes: dict :param issuer_type: The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. :type issuer_type: str :param name: Certificate issuer name, unique per account. :type name: str :return: A new instance of a CertificateIssuer Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_issuer.CertificateIssuer ''' pass def certificate_issuer_config( self, certificate_issuer_id=None, created_at=None, id=None, reference=None, updated_at=None ): '''Creates a local `CertificateIssuerConfig` instance, using the shared SDK context. :param certificate_issuer_id: The ID of the certificate issuer. Null if Device Management internal HSM is used. :type certificate_issuer_id: str :param created_at: Created UTC time RFC3339. :type created_at: datetime :param id: The ID of the certificate issuer configuration. :type id: str :param reference: The certificate name to which the certificate issuer configuration applies. :type reference: str :param updated_at: Updated UTC time RFC3339. :type updated_at: datetime :return: A new instance of a CertificateIssuerConfig Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.certificate_issuer_config.CertificateIssuerConfig ''' pass def dark_theme_color(self, color=None, reference=None, updated_at=None): '''Creates a local `DarkThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a DarkThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.dark_theme_color.DarkThemeColor ''' pass def dark_theme_image(self, reference=None, static_uri=None, updated_at=None): '''Creates a local `DarkThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a DarkThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.dark_theme_image.DarkThemeImage ''' pass def developer_certificate( self, account_id=None, certificate=None, created_at=None, description=None, developer_private_key=None, id=None, name=None, security_file_content=None, ): '''Creates a local `DeveloperCertificate` instance, using the shared SDK context. :param account_id: Account to which the developer certificate belongs. :type account_id: str :param certificate: PEM-format X.509 developer certificate. :type certificate: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Description for the developer certificate. :type description: str :param developer_private_key: PEM-format developer private key associated with the certificate. :type developer_private_key: str :param id: ID that uniquely identifies the developer certificate. :type id: str :param name: Name of the developer certificate. :type name: str :param security_file_content: Content of the `security.c` file flashed to the device to provide security credentials. :type security_file_content: str :return: A new instance of a DeveloperCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.developer_certificate.DeveloperCertificate ''' pass def device( self, account_id=None, auto_update=None, bootstrap_expiration_date=None, bootstrapped_timestamp=None, ca_id=None, connector_expiration_date=None, created_at=None, custom_attributes=None, deployed_state=None, deployment=None, description=None, device_class=None, device_execution_mode=None, device_key=None, endpoint_name=None, endpoint_type=None, enrolment_list_timestamp=None, firmware_checksum=None, host_gateway=None, id=None, issuer_fingerprint=None, manifest=None, manifest_timestamp=None, mechanism=None, mechanism_url=None, name=None, serial_number=None, state=None, updated_at=None, vendor_id=None, ): '''Creates a local `Device` instance, using the shared SDK context. :param account_id: The ID of the associated account. :type account_id: str :param auto_update: DEPRECATED: Mark this device for automatic firmware update. :type auto_update: bool :param bootstrap_expiration_date: The expiration date of the certificate used to connect to bootstrap server. :type bootstrap_expiration_date: date :param bootstrapped_timestamp: The timestamp of the device's most recent bootstrap process. :type bootstrapped_timestamp: datetime :param ca_id: The certificate issuer's ID. :type ca_id: str :param connector_expiration_date: The expiration date of the certificate used to connect to LwM2M server. :type connector_expiration_date: date :param created_at: The timestamp of when the device was created in the device directory. :type created_at: datetime :param custom_attributes: Up to five custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param deployed_state: DEPRECATED: The state of the device's deployment. :type deployed_state: str :param deployment: DEPRECATED: The last deployment used on the device. :type deployment: str :param description: The description of the device. :type description: str :param device_class: An ID representing the model and hardware revision of the device. :type device_class: str :param device_execution_mode: The execution mode from the certificate of the device. Defaults to inheriting from host_gateway device. Permitted values: - 0 - unspecified execution mode (default if host_gateway invalid or not set) - 1 - development devices - 5 - production devices :type device_execution_mode: int :param device_key: The fingerprint of the device certificate. :type device_key: str :param endpoint_name: The endpoint name given to the device. :type endpoint_name: str :param endpoint_type: The endpoint type of the device. For example, the device is a gateway. :type endpoint_type: str :param enrolment_list_timestamp: The claim date/time. :type enrolment_list_timestamp: datetime :param firmware_checksum: The SHA256 checksum of the current firmware image. :type firmware_checksum: str :param host_gateway: The ID of the host gateway, if appropriate. :type host_gateway: str :param id: The ID of the device. The device ID is used across all Device Management APIs. :type id: str :param issuer_fingerprint: SHA256 fingerprint of the certificate used to validate the signature of the device certificate. :type issuer_fingerprint: str :param manifest: DEPRECATED: The URL for the current device manifest. :type manifest: str :param manifest_timestamp: The timestamp of the current manifest version. :type manifest_timestamp: datetime :param mechanism: The ID of the channel used to communicate with the device. :type mechanism: str :param mechanism_url: The address of the connector to use. :type mechanism_url: str :param name: The name of the device. :type name: str :param serial_number: The serial number of the device. :type serial_number: str :param state: The current state of the device. :type state: str :param updated_at: The time the object was updated. :type updated_at: datetime :param vendor_id: The device vendor ID. :type vendor_id: str :return: A new instance of a Device Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device.Device ''' pass def device_enrollment( self, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, expires_at=None, id=None, ): '''Creates a local `DeviceEnrollment` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param claimed_at: The time the device was claimed. :type claimed_at: datetime :param created_at: The time of the enrollment identity creation. :type created_at: datetime :param enrolled_device_id: The ID of the device in the Device Directory once it is registered. :type enrolled_device_id: str :param enrollment_identity: Enrollment identity. :type enrollment_identity: str :param expires_at: The enrollment claim expiration time. If the device does not connect to Device Management before expiration, the claim is removed without separate notice. :type expires_at: datetime :param id: Enrollment identity. :type id: str :return: A new instance of a DeviceEnrollment Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment.DeviceEnrollment ''' pass def device_enrollment_bulk_create( self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): '''Creates a local `DeviceEnrollmentBulkCreate` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int :return: A new instance of a DeviceEnrollmentBulkCreate Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_bulk_create.DeviceEnrollmentBulkCreate ''' pass def device_enrollment_bulk_delete( self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, full_report_file=None, id=None, processed_count=None, status=None, total_count=None, ): '''Creates a local `DeviceEnrollmentBulkDelete` instance, using the shared SDK context. :param account_id: ID :type account_id: str :param completed_at: The time the bulk creation task was completed. Null when creating bulk upload or delete. :type completed_at: datetime :param created_at: The time of receiving the bulk creation task. :type created_at: datetime :param errors_count: The number of enrollment identities with failed processing. :type errors_count: int :param errors_report_file: Link to error report file. Null when creating bulk upload or delete. :type errors_report_file: str :param full_report_file: Link to full report file. Null when creating bulk upload or delete. :type full_report_file: str :param id: Bulk ID :type id: str :param processed_count: The number of enrollment identities processed until now. :type processed_count: int :param status: The state of the process is 'new' at the time of creation. If creation is still in progress, the state shows as 'processing'. When the request is fully processed, the state changes to 'completed'. :type status: str :param total_count: Total number of enrollment identities found in the input CSV. :type total_count: int :return: A new instance of a DeviceEnrollmentBulkDelete Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_bulk_delete.DeviceEnrollmentBulkDelete ''' pass def device_enrollment_denial( self, account_id=None, created_at=None, endpoint_name=None, id=None, trusted_certificate_id=None ): '''Creates a local `DeviceEnrollmentDenial` instance, using the shared SDK context. :param account_id: account id :type account_id: str :param created_at: date on which the failed bootstrap was attempted on :type created_at: datetime :param endpoint_name: endpoint name :type endpoint_name: str :param id: id of the recorded failed bootstrap attempt :type id: str :param trusted_certificate_id: Trusted certificate id :type trusted_certificate_id: str :return: A new instance of a DeviceEnrollmentDenial Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_enrollment_denial.DeviceEnrollmentDenial ''' pass def device_events( self, changes=None, created_at=None, data=None, date_time=None, description=None, device_id=None, event_type=None, event_type_category=None, event_type_description=None, id=None, state_change=None, ): '''Creates a local `DeviceEvents` instance, using the shared SDK context. :param changes: :type changes: dict :param created_at: :type created_at: datetime :param data: Additional data relevant to the event. :type data: dict :param date_time: :type date_time: datetime :param description: :type description: str :param device_id: :type device_id: str :param event_type: Event code :type event_type: str :param event_type_category: Category code which groups the event type by a summary category. :type event_type_category: str :param event_type_description: Generic description of the event :type event_type_description: str :param id: :type id: str :param state_change: :type state_change: bool :return: A new instance of a DeviceEvents Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_events.DeviceEvents ''' pass def device_group( self, created_at=None, custom_attributes=None, description=None, devices_count=None, id=None, name=None, updated_at=None, ): '''Creates a local `DeviceGroup` instance, using the shared SDK context. :param created_at: The time the campaign was created. :type created_at: datetime :param custom_attributes: Up to ten custom key-value attributes. Note that keys cannot begin with a number. Both keys and values are limited to 128 characters. Updating this field replaces existing contents. :type custom_attributes: dict :param description: The description of the group. :type description: str :param devices_count: The number of devices in this group. :type devices_count: int :param id: The group ID. :type id: str :param name: Name of the group. :type name: str :param updated_at: The time the object was updated. :type updated_at: datetime :return: A new instance of a DeviceGroup Foundation Entity. :rtype: mbed_cloud.foundation.entities.devices.device_group.DeviceGroup ''' pass def firmware_image( self, created_at=None, datafile_checksum=None, datafile_size=None, datafile_url=None, description=None, id=None, name=None, updated_at=None, ): '''Creates a local `FirmwareImage` instance, using the shared SDK context. :param created_at: The time the object was created :type created_at: datetime :param datafile_checksum: The checksum (sha256) generated for the datafile :type datafile_checksum: str :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The firmware image file URL :type datafile_url: str :param description: The description of the object :type description: str :param id: The firmware image ID :type id: str :param name: The firmware image name :type name: str :param updated_at: The time the object was updated :type updated_at: datetime :return: A new instance of a FirmwareImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.firmware_image.FirmwareImage ''' pass def firmware_manifest( self, created_at=None, datafile_size=None, datafile_url=None, description=None, device_class=None, id=None, key_table_url=None, name=None, timestamp=None, updated_at=None, ): '''Creates a local `FirmwareManifest` instance, using the shared SDK context. :param created_at: The time the object was created :type created_at: datetime :param datafile_size: The size of the datafile in bytes :type datafile_size: int :param datafile_url: The URL of the firmware manifest binary :type datafile_url: str :param description: The description of the firmware manifest :type description: str :param device_class: The class of the device :type device_class: str :param id: The firmware manifest ID :type id: str :param key_table_url: The key table of pre-shared keys for devices :type key_table_url: str :param name: The name of the object :type name: str :param timestamp: The firmware manifest version as a timestamp :type timestamp: datetime :param updated_at: The time the object was updated :type updated_at: datetime :return: A new instance of a FirmwareManifest Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.firmware_manifest.FirmwareManifest ''' pass def light_theme_color(self, color=None, reference=None, updated_at=None): '''Creates a local `LightThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a LightThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.light_theme_color.LightThemeColor ''' pass def light_theme_image(self, reference=None, static_uri=None, updated_at=None): '''Creates a local `LightThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a LightThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.light_theme_image.LightThemeImage ''' pass def login_history(self, date=None, ip_address=None, success=None, user_agent=None): '''Creates a local `LoginHistory` instance, using the shared SDK context. :param date: UTC time RFC3339 for this login attempt. :type date: datetime :param ip_address: IP address of the client. :type ip_address: str :param success: Flag indicating whether login attempt was successful or not. :type success: bool :param user_agent: User Agent header from the login request. :type user_agent: str :return: A new instance of a LoginHistory Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.login_history.LoginHistory ''' pass def login_profile(self, id=None, name=None): '''Creates a local `LoginProfile` instance, using the shared SDK context. :param id: ID of the identity provider. :type id: str :param name: Name of the identity provider. :type name: str :return: A new instance of a LoginProfile Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.login_profile.LoginProfile ''' pass def parent_account(self, admin_email=None, admin_name=None, id=None): '''Creates a local `ParentAccount` instance, using the shared SDK context. :param admin_email: The email address of the admin user who is the contact person of the parent account. :type admin_email: str :param admin_name: The name of the admin user who is the contact person of the parent account. :type admin_name: str :param id: The ID of the parent account. :type id: str :return: A new instance of a ParentAccount Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.parent_account.ParentAccount ''' pass def password_policy(self, minimum_length=None): '''Creates a local `PasswordPolicy` instance, using the shared SDK context. :param minimum_length: Minimum length for the password. :type minimum_length: int :return: A new instance of a PasswordPolicy Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.password_policy.PasswordPolicy ''' pass def policy(self, action=None, allow=None, feature=None, inherited=None, resource=None): '''Creates a local `Policy` instance, using the shared SDK context. :param action: Comma-separated list of actions, empty string represents all actions. :type action: str :param allow: True or false controlling whether an action is allowed or not. :type allow: bool :param feature: Feature name corresponding to this policy. :type feature: str :param inherited: Flag indicating whether this feature is inherited or overwritten specifically. :type inherited: bool :param resource: Resource that is protected by this policy. :type resource: str :return: A new instance of a Policy Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.policy.Policy ''' pass def pre_shared_key(self, created_at=None, endpoint_name=None, id=None): '''Creates a local `PreSharedKey` instance, using the shared SDK context. :param created_at: The date-time (RFC3339) when this PSK was uploaded to Device Management. :type created_at: datetime :param endpoint_name: The unique endpoint identifier that this PSK applies to. 16-64 [pr intable](https://en.wikipedia.org/wiki/ASCII#Printable_characters) (non-control) ASCII characters. :type endpoint_name: str :param id: The Id of the pre_shared_key, shadows the endpoint_name :type id: str :return: A new instance of a PreSharedKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.pre_shared_key.PreSharedKey ''' pass def server_credentials(self, created_at=None, id=None, server_certificate=None, server_uri=None): '''Creates a local `ServerCredentials` instance, using the shared SDK context. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param id: Unique entity ID. :type id: str :param server_certificate: PEM-format X.509 server certificate used to validate the server certificate received during the TLS/DTLS handshake. :type server_certificate: str :param server_uri: Server URI that the client connects to. :type server_uri: str :return: A new instance of a ServerCredentials Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.server_credentials.ServerCredentials ''' pass def subtenant_api_key( self, account_id=None, created_at=None, creation_time=None, id=None, key=None, last_login_time=None, name=None, owner=None, status=None, updated_at=None, ): '''Creates a local `SubtenantApiKey` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: The timestamp of the API key creation in the storage, in milliseconds. :type creation_time: int :param id: The ID of the API key. :type id: str :param key: The API key. :type key: str :param last_login_time: The timestamp of the latest API key usage, in milliseconds. :type last_login_time: int :param name: The display name for the API key. :type name: str :param owner: The owner of this API key, who is the creator by default. :type owner: str :param status: The status of the API key. :type status: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :return: A new instance of a SubtenantApiKey Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_api_key.SubtenantApiKey ''' pass def subtenant_dark_theme_color(self, color=None, reference=None, updated_at=None): '''Creates a local `SubtenantDarkThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantDarkThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_dark_theme_color.SubtenantDarkThemeColor ''' pass def subtenant_dark_theme_image(self, reference=None, static_uri=None, updated_at=None): '''Creates a local `SubtenantDarkThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantDarkThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_dark_theme_image.SubtenantDarkThemeImage ''' pass def subtenant_light_theme_color(self, color=None, reference=None, updated_at=None): '''Creates a local `SubtenantLightThemeColor` instance, using the shared SDK context. :param color: The color given as name (purple) or as a hex code. :type color: str :param reference: Color name. :type reference: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantLightThemeColor Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_light_theme_color.SubtenantLightThemeColor ''' pass def subtenant_light_theme_image(self, reference=None, static_uri=None, updated_at=None): '''Creates a local `SubtenantLightThemeImage` instance, using the shared SDK context. :param reference: Name of the image. :type reference: str :param static_uri: The static link to the image. :type static_uri: str :param updated_at: Last update time in UTC. :type updated_at: datetime :return: A new instance of a SubtenantLightThemeImage Foundation Entity. :rtype: mbed_cloud.foundation.entities.branding.subtenant_light_theme_image.SubtenantLightThemeImage ''' pass def subtenant_trusted_certificate( self, account_id=None, certificate=None, certificate_fingerprint=None, created_at=None, description=None, device_execution_mode=None, enrollment_mode=None, id=None, is_developer_certificate=None, issuer=None, name=None, owner_id=None, service=None, status=None, subject=None, updated_at=None, valid=None, validity=None, ): '''Creates a local `SubtenantTrustedCertificate` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param certificate: X509.v3 trusted certificate in PEM format. :type certificate: str :param certificate_fingerprint: A SHA-256 fingerprint of the certificate. :type certificate_fingerprint: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Human readable description of this certificate. :type description: str :param device_execution_mode: Device execution mode where 1 means a developer certificate. :type device_execution_mode: int :param enrollment_mode: If true, signature is not required. Default value false. :type enrollment_mode: bool :param id: Entity ID. :type id: str :param is_developer_certificate: Whether or not this certificate is a developer certificate. :type is_developer_certificate: bool :param issuer: Issuer of the certificate. :type issuer: str :param name: Certificate name. :type name: str :param owner_id: The ID of the owner. :type owner_id: str :param service: Service name where the certificate is used. :type service: str :param status: Status of the certificate. :type status: str :param subject: Subject of the certificate. :type subject: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param valid: This read-only flag indicates whether the certificate is valid or not. :type valid: bool :param validity: Expiration time in UTC formatted as RFC3339. :type validity: datetime :return: A new instance of a SubtenantTrustedCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.subtenant_trusted_certificate.SubtenantTrustedCertificate ''' pass def subtenant_user( self, account_id=None, active_sessions=None, address=None, created_at=None, creation_time=None, custom_fields=None, email=None, email_verified=None, full_name=None, id=None, is_gtc_accepted=None, is_marketing_accepted=None, is_totp_enabled=None, last_login_time=None, login_history=None, login_profiles=None, password=None, password_changed_time=None, phone_number=None, status=None, totp_scratch_codes=None, updated_at=None, username=None, ): '''Creates a local `SubtenantUser` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param active_sessions: List of active user sessions. :type active_sessions: list :param address: Address. :type address: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: A timestamp of the user creation in the storage, in milliseconds. :type creation_time: int :param custom_fields: User's account-specific custom properties. The value is a string. :type custom_fields: dict :param email: The email address. :type email: str :param email_verified: A flag indicating whether the user's email address has been verified or not. :type email_verified: bool :param full_name: The full name of the user. :type full_name: str :param id: The ID of the user. :type id: str :param is_gtc_accepted: A flag indicating that the user has accepted General Terms and Conditions. :type is_gtc_accepted: bool :param is_marketing_accepted: A flag indicating that the user has consented to receive marketing information. :type is_marketing_accepted: bool :param is_totp_enabled: A flag indicating whether two-factor authentication (TOTP) has been enabled. :type is_totp_enabled: bool :param last_login_time: A timestamp of the latest login of the user, in milliseconds. :type last_login_time: int :param login_history: Timestamps, succeedings, IP addresses and user agent information of the last five logins of the user, with timestamps in RFC3339 format. :type login_history: list :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param password: The password when creating a new user. It will be generated when not present in the request. :type password: str :param password_changed_time: A timestamp of the latest change of the user password, in milliseconds. :type password_changed_time: int :param phone_number: Phone number. :type phone_number: str :param status: The status of the user. ENROLLING state indicates that the user is in the middle of the enrollment process. INVITED means that the user has not accepted the invitation request. RESET means that the password must be changed immediately. INACTIVE users are locked out and not permitted to use the system. :type status: str :param totp_scratch_codes: A list of scratch codes for the two-factor authentication. Visible only when 2FA is requested to be enabled or the codes regenerated. :type totp_scratch_codes: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param username: A username. :type username: str :return: A new instance of a SubtenantUser Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_user.SubtenantUser ''' pass def subtenant_user_invitation( self, account_id=None, created_at=None, email=None, expiration=None, id=None, login_profiles=None, updated_at=None, user_id=None, ): '''Creates a local `SubtenantUserInvitation` instance, using the shared SDK context. :param account_id: The ID of the account the user is invited to. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param email: Email address of the invited user. :type email: str :param expiration: Invitation expiration as UTC time RFC3339. :type expiration: datetime :param id: The ID of the invitation. :type id: str :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param user_id: The ID of the invited user. :type user_id: str :return: A new instance of a SubtenantUserInvitation Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.subtenant_user_invitation.SubtenantUserInvitation ''' pass def trusted_certificate( self, account_id=None, certificate=None, certificate_fingerprint=None, created_at=None, description=None, device_execution_mode=None, enrollment_mode=None, id=None, is_developer_certificate=None, issuer=None, name=None, owner_id=None, service=None, status=None, subject=None, updated_at=None, valid=None, validity=None, ): '''Creates a local `TrustedCertificate` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param certificate: X509.v3 trusted certificate in PEM format. :type certificate: str :param certificate_fingerprint: A SHA-256 fingerprint of the certificate. :type certificate_fingerprint: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: Human readable description of this certificate. :type description: str :param device_execution_mode: Device execution mode where 1 means a developer certificate. :type device_execution_mode: int :param enrollment_mode: If true, signature is not required. Default value false. :type enrollment_mode: bool :param id: Entity ID. :type id: str :param is_developer_certificate: Whether or not this certificate is a developer certificate. :type is_developer_certificate: bool :param issuer: Issuer of the certificate. :type issuer: str :param name: Certificate name. :type name: str :param owner_id: The ID of the owner. :type owner_id: str :param service: Service name where the certificate is used. :type service: str :param status: Status of the certificate. :type status: str :param subject: Subject of the certificate. :type subject: str :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param valid: This read-only flag indicates whether the certificate is valid or not. :type valid: bool :param validity: Expiration time in UTC formatted as RFC3339. :type validity: datetime :return: A new instance of a TrustedCertificate Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.trusted_certificate.TrustedCertificate ''' pass def update_campaign( self, autostop_reason=None, created_at=None, description=None, device_filter=None, device_filter_helper=None, finished=None, id=None, name=None, phase=None, root_manifest_id=None, root_manifest_url=None, started_at=None, updated_at=None, when=None, ): '''Creates a local `UpdateCampaign` instance, using the shared SDK context. :param autostop_reason: Text description of why a campaign failed to start or why a campaign stopped. :type autostop_reason: str :param created_at: The time the update campaign was created :type created_at: datetime :param description: An optional description of the campaign :type description: str :param device_filter: The filter for the devices the campaign is targeting at :type device_filter: str :param device_filter_helper: Helper for creating the device filter string. :type device_filter_helper: mbed_cloud.client.api_filter.ApiFilter :param finished: The campaign finish timestamp :type finished: datetime :param id: The campaign ID :type id: str :param name: The campaign name :type name: str :param phase: The current phase of the campaign. :type phase: str :param root_manifest_id: :type root_manifest_id: str :param root_manifest_url: :type root_manifest_url: str :param started_at: :type started_at: datetime :param updated_at: The time the object was updated :type updated_at: datetime :param when: The scheduled start time for the campaign. The campaign will start within 1 minute when then start time has elapsed. :type when: datetime :return: A new instance of a UpdateCampaign Foundation Entity. :rtype: mbed_cloud.foundation.entities.device_update.update_campaign.UpdateCampaign ''' pass def user( self, account_id=None, active_sessions=None, address=None, created_at=None, creation_time=None, custom_fields=None, email=None, email_verified=None, full_name=None, id=None, is_gtc_accepted=None, is_marketing_accepted=None, is_totp_enabled=None, last_login_time=None, login_history=None, login_profiles=None, password=None, password_changed_time=None, phone_number=None, status=None, totp_scratch_codes=None, updated_at=None, username=None, ): '''Creates a local `User` instance, using the shared SDK context. :param account_id: The ID of the account. :type account_id: str :param active_sessions: List of active user sessions. :type active_sessions: list :param address: Address. :type address: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param creation_time: A timestamp of the user creation in the storage, in milliseconds. :type creation_time: int :param custom_fields: User's account-specific custom properties. The value is a string. :type custom_fields: dict :param email: The email address. :type email: str :param email_verified: A flag indicating whether the user's email address has been verified or not. :type email_verified: bool :param full_name: The full name of the user. :type full_name: str :param id: The ID of the user. :type id: str :param is_gtc_accepted: A flag indicating that the user has accepted General Terms and Conditions. :type is_gtc_accepted: bool :param is_marketing_accepted: A flag indicating that the user has consented to receive marketing information. :type is_marketing_accepted: bool :param is_totp_enabled: A flag indicating whether two-factor authentication (TOTP) has been enabled. :type is_totp_enabled: bool :param last_login_time: A timestamp of the latest login of the user, in milliseconds. :type last_login_time: int :param login_history: Timestamps, succeedings, IP addresses and user agent information of the last five logins of the user, with timestamps in RFC3339 format. :type login_history: list :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param password: The password when creating a new user. It will be generated when not present in the request. :type password: str :param password_changed_time: A timestamp of the latest change of the user password, in milliseconds. :type password_changed_time: int :param phone_number: Phone number. :type phone_number: str :param status: The status of the user. ENROLLING state indicates that the user is in the middle of the enrollment process. INVITED means that the user has not accepted the invitation request. RESET means that the password must be changed immediately. INACTIVE users are locked out and not permitted to use the system. :type status: str :param totp_scratch_codes: A list of scratch codes for the two-factor authentication. Visible only when 2FA is requested to be enabled or the codes regenerated. :type totp_scratch_codes: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param username: A username. :type username: str :return: A new instance of a User Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.user.User ''' pass def user_invitation( self, account_id=None, created_at=None, email=None, expiration=None, id=None, login_profiles=None, updated_at=None, user_id=None, ): '''Creates a local `UserInvitation` instance, using the shared SDK context. :param account_id: The ID of the account the user is invited to. :type account_id: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param email: Email address of the invited user. :type email: str :param expiration: Invitation expiration as UTC time RFC3339. :type expiration: datetime :param id: The ID of the invitation. :type id: str :param login_profiles: A list of login profiles for the user. Specified as the identity providers the user is associated with. :type login_profiles: list :param updated_at: Last update UTC time RFC3339. :type updated_at: datetime :param user_id: The ID of the invited user. :type user_id: str :return: A new instance of a UserInvitation Foundation Entity. :rtype: mbed_cloud.foundation.entities.accounts.user_invitation.UserInvitation ''' pass def verification_response(self, message=None, successful=None): '''Creates a local `VerificationResponse` instance, using the shared SDK context. :param message: Provides details in case of failure. :type message: str :param successful: Indicates whether the certificate issuer was verified successfully. :type successful: bool :return: A new instance of a VerificationResponse Foundation Entity. :rtype: mbed_cloud.foundation.entities.security.verification_response.VerificationResponse ''' pass
45
45
46
3
20
24
1
1.18
0
43
43
0
44
1
44
44
2,088
173
880
441
440
1,035
132
89
44
1
0
0
44
2,325
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/security/certificate_enrollment.py
mbed_cloud.foundation.entities.security.certificate_enrollment.CertificateEnrollment
class CertificateEnrollment(Entity): """Represents the `CertificateEnrollment` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "certificate_name", "created_at", "device_id", "enroll_result", "enroll_result_detail", "enroll_status", "id", "updated_at", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, certificate_name=None, created_at=None, device_id=None, enroll_result=None, enroll_result_detail=None, enroll_status=None, id=None, updated_at=None, ): """Creates a local `CertificateEnrollment` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param certificate_name: The certificate name. :type certificate_name: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param device_id: The device ID. :type device_id: str :param enroll_result: The result of certificate enrollment request. :type enroll_result: str :param enroll_result_detail: Additional information in case of failure. :type enroll_result_detail: str :param enroll_status: The status of certificate enrollment request. :type enroll_status: str :param id: (Required) The certificate enrollment ID. :type id: str :param updated_at: Update UTC time RFC3339. :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._certificate_name = fields.StringField(value=certificate_name) self._created_at = fields.DateTimeField(value=created_at) self._device_id = fields.StringField(value=device_id) self._enroll_result = fields.StringField(value=enroll_result, enum=enums.CertificateEnrollmentEnrollResultEnum) self._enroll_result_detail = fields.StringField(value=enroll_result_detail) self._enroll_status = fields.StringField(value=enroll_status, enum=enums.CertificateEnrollmentEnrollStatusEnum) self._id = fields.StringField(value=id) self._updated_at = fields.DateTimeField(value=updated_at) @property def certificate_name(self): """The certificate name. api example: 'customer.dlms' :rtype: str """ return self._certificate_name.value @property def created_at(self): """Creation UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime """ return self._created_at.value @property def device_id(self): """The device ID. api example: '01625daa23230a580a0100bd00000000' :rtype: str """ return self._device_id.value @property def enroll_result(self): """The result of certificate enrollment request. api example: 'success' :rtype: str """ return self._enroll_result.value @property def enroll_result_detail(self): """Additional information in case of failure. api example: 'The device is currently processing too many certificate renewals.' :rtype: str """ return self._enroll_result_detail.value @property def enroll_status(self): """The status of certificate enrollment request. :rtype: str """ return self._enroll_status.value @property def id(self): """The certificate enrollment ID. This field must be set when updating or deleting an existing CertificateEnrollment Entity. api example: '01612df56f3b0a580a010fc700000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def updated_at(self): """Update UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime """ return self._updated_at.value def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get certificate enrollments list. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-enrollments>`_. **API Filters** The following filters are supported by the API when listing CertificateEnrollment entities: +------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==================+======+======+======+======+======+======+======+ | certificate_name | Y | | | | | | | +------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | | | | +------------------+------+------+------+------+------+------+------+ | device_id | Y | | | | | | | +------------------+------+------+------+------+------+------+------+ | enroll_result | Y | Y | | | | | | +------------------+------+------+------+------+------+------+------+ | enroll_status | Y | Y | | | | | | +------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | | | | +------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import CertificateEnrollment from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("certificate_name", "eq", <filter value>) for certificate_enrollment in CertificateEnrollment().list(filter=api_filter): print(certificate_enrollment.certificate_name) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of results. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return (2-1000). :type page_size: int :param include: a comma-separated list of data fields to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateEnrollment) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CertificateEnrollment from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CertificateEnrollment._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CertificateEnrollment._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CertificateEnrollment, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """Get certificate enrollments list. :param after: The ID of the item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of results. :type order: str :param limit: The number of results to return (2-1000). :type limit: int :param include: a comma-separated list of data fields to return. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order, enum=enums.CertificateEnrollmentOrderEnum).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include, enum=enums.CertificateEnrollmentIncludeEnum).to_api() return self._client.call_api( method="get", path="/v3/certificate-enrollments", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get a certificate enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-enrollments/{certificate-enrollment-id}>`_. :rtype: CertificateEnrollment """ return self._client.call_api( method="get", path="/v3/certificate-enrollments/{certificate-enrollment-id}", content_type="application/json", path_params={"certificate-enrollment-id": self._id.to_api()}, unpack=self, )
class CertificateEnrollment(Entity): '''Represents the `CertificateEnrollment` entity in Pelion Device Management''' def __init__( self, _client=None, certificate_name=None, created_at=None, device_id=None, enroll_result=None, enroll_result_detail=None, enroll_status=None, id=None, updated_at=None, ): '''Creates a local `CertificateEnrollment` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param certificate_name: The certificate name. :type certificate_name: str :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param device_id: The device ID. :type device_id: str :param enroll_result: The result of certificate enrollment request. :type enroll_result: str :param enroll_result_detail: Additional information in case of failure. :type enroll_result_detail: str :param enroll_status: The status of certificate enrollment request. :type enroll_status: str :param id: (Required) The certificate enrollment ID. :type id: str :param updated_at: Update UTC time RFC3339. :type updated_at: datetime ''' pass @property def certificate_name(self): '''The certificate name. api example: 'customer.dlms' :rtype: str ''' pass @property def created_at(self): '''Creation UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime ''' pass @property def device_id(self): '''The device ID. api example: '01625daa23230a580a0100bd00000000' :rtype: str ''' pass @property def enroll_result(self): '''The result of certificate enrollment request. api example: 'success' :rtype: str ''' pass @property def enroll_result_detail(self): '''Additional information in case of failure. api example: 'The device is currently processing too many certificate renewals.' :rtype: str ''' pass @property def enroll_status(self): '''The status of certificate enrollment request. :rtype: str ''' pass @property def id(self): '''The certificate enrollment ID. This field must be set when updating or deleting an existing CertificateEnrollment Entity. api example: '01612df56f3b0a580a010fc700000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def updated_at(self): '''Update UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Get certificate enrollments list. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-enrollments>`_. **API Filters** The following filters are supported by the API when listing CertificateEnrollment entities: +------------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==================+======+======+======+======+======+======+======+ | certificate_name | Y | | | | | | | +------------------+------+------+------+------+------+------+------+ | created_at | | | Y | Y | | | | +------------------+------+------+------+------+------+------+------+ | device_id | Y | | | | | | | +------------------+------+------+------+------+------+------+------+ | enroll_result | Y | Y | | | | | | +------------------+------+------+------+------+------+------+------+ | enroll_status | Y | Y | | | | | | +------------------+------+------+------+------+------+------+------+ | updated_at | | | Y | Y | | | | +------------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import CertificateEnrollment from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("certificate_name", "eq", <filter value>) for certificate_enrollment in CertificateEnrollment().list(filter=api_filter): print(certificate_enrollment.certificate_name) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of results. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return (2-1000). :type page_size: int :param include: a comma-separated list of data fields to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateEnrollment) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''Get certificate enrollments list. :param after: The ID of the item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of results. :type order: str :param limit: The number of results to return (2-1000). :type limit: int :param include: a comma-separated list of data fields to return. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a certificate enrollment by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-enrollments/{certificate-enrollment-id}>`_. :rtype: CertificateEnrollment ''' pass
23
14
20
5
6
10
1
1.25
1
11
8
0
13
8
13
24
311
77
104
50
67
130
52
30
35
5
2
2
18
2,326
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/security/certificate_issuer.py
mbed_cloud.foundation.entities.security.certificate_issuer.CertificateIssuer
class CertificateIssuer(Entity): """Represents the `CertificateIssuer` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = ["created_at", "description", "id", "issuer_attributes", "issuer_type", "name"] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, created_at=None, description=None, id=None, issuer_attributes=None, issuer_type=None, name=None, ): """Creates a local `CertificateIssuer` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: General description for the certificate issuer. :type description: str :param id: (Required) The ID of the certificate issuer. :type id: str :param issuer_attributes: General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :type issuer_attributes: dict :param issuer_type: (Required) The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. :type issuer_type: str :param name: (Required) Certificate issuer name, unique per account. :type name: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._created_at = fields.DateTimeField(value=created_at) self._description = fields.StringField(value=description) self._id = fields.StringField(value=id) self._issuer_attributes = fields.DictField(value=issuer_attributes) self._issuer_type = fields.StringField(value=issuer_type, enum=enums.CertificateIssuerTypeEnum) self._name = fields.StringField(value=name) @property def created_at(self): """Creation UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime """ return self._created_at.value @property def description(self): """General description for the certificate issuer. api example: 'GlobalSign sample issuer' :rtype: str """ return self._description.value @description.setter def description(self, value): """Set value of `description` :param value: value to set :type value: str """ self._description.set(value) @property def id(self): """The ID of the certificate issuer. This field must be set when updating or deleting an existing CertificateIssuer Entity. api example: '01234567890ABCDEF01234567890ABCDEF' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def issuer_attributes(self): """General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :rtype: dict """ return self._issuer_attributes.value @issuer_attributes.setter def issuer_attributes(self, value): """Set value of `issuer_attributes` :param value: value to set :type value: dict """ self._issuer_attributes.set(value) @property def issuer_type(self): """The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. This field must be set when creating a new CertificateIssuer Entity. api example: 'GLOBAL_SIGN' :rtype: str """ return self._issuer_type.value @issuer_type.setter def issuer_type(self, value): """Set value of `issuer_type` :param value: value to set :type value: str """ self._issuer_type.set(value) @property def name(self): """Certificate issuer name, unique per account. This field must be set when creating a new CertificateIssuer Entity. api example: 'GS Issuer' :rtype: str """ return self._name.value @name.setter def name(self, value): """Set value of `name` :param value: value to set :type value: str """ self._name.set(value) def create(self, issuer_credentials): """Create certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers>`_. :param issuer_credentials: The credentials required for connecting to the certificate issuer. When the issuer_type is GLOBAL_SIGN, see definition of GlobalSignCredentials. When the issuer_type is CFSSL_AUTH, see definition of CfsslAuthCredentials. :type issuer_credentials: dict :rtype: CertificateIssuer """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._description.value_set: body_params["description"] = self._description.to_api() if self._issuer_attributes.value_set: body_params["issuer_attributes"] = self._issuer_attributes.to_api() # Method parameters are unconditionally sent even if set to None body_params["issuer_credentials"] = fields.DictField(issuer_credentials).to_api() if self._issuer_type.value_set: body_params["issuer_type"] = self._issuer_type.to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="post", path="/v3/certificate-issuers", content_type="application/json", body_params=body_params, unpack=self, ) def delete(self): """Delete certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :rtype: CertificateIssuer """ return self._client.call_api( method="delete", path="/v3/certificate-issuers/{certificate-issuer-id}", content_type="application/json", path_params={"certificate-issuer-id": self._id.to_api()}, unpack=self, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get certificate issuers list. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateIssuer) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CertificateIssuer from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CertificateIssuer._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CertificateIssuer._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CertificateIssuer, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """Get certificate issuers list. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/certificate-issuers", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Get certificate issuer by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :rtype: CertificateIssuer """ return self._client.call_api( method="get", path="/v3/certificate-issuers/{certificate-issuer-id}", content_type="application/json", path_params={"certificate-issuer-id": self._id.to_api()}, unpack=self, ) def update(self, issuer_credentials=None): """Update certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :param issuer_credentials: The credentials required for connecting to the certificate issuer. When the issuer_type is GLOBAL_SIGN, see definition of GlobalSignCredentials. When the issuer_type is CFSSL_AUTH, see definition of CfsslAuthCredentials. :type issuer_credentials: dict :rtype: CertificateIssuer """ # Conditionally setup the message body, fields which have not been set will not be sent to the API. # This avoids null fields being rejected and allows the default value to be used. body_params = {} if self._description.value_set: body_params["description"] = self._description.to_api() if self._issuer_attributes.value_set: body_params["issuer_attributes"] = self._issuer_attributes.to_api() # Method parameters are unconditionally sent even if set to None body_params["issuer_credentials"] = fields.DictField(issuer_credentials).to_api() if self._name.value_set: body_params["name"] = self._name.to_api() return self._client.call_api( method="put", path="/v3/certificate-issuers/{certificate-issuer-id}", content_type="application/json", body_params=body_params, path_params={"certificate-issuer-id": self._id.to_api()}, unpack=self, ) def verify(self): """Verify certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}/verify>`_. :rtype: VerificationResponse """ from mbed_cloud.foundation import VerificationResponse return self._client.call_api( method="post", path="/v3/certificate-issuers/{certificate-issuer-id}/verify", content_type="application/json", path_params={"certificate-issuer-id": self._id.to_api()}, unpack=VerificationResponse, )
class CertificateIssuer(Entity): '''Represents the `CertificateIssuer` entity in Pelion Device Management''' def __init__( self, _client=None, created_at=None, description=None, id=None, issuer_attributes=None, issuer_type=None, name=None, ): '''Creates a local `CertificateIssuer` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param created_at: Creation UTC time RFC3339. :type created_at: datetime :param description: General description for the certificate issuer. :type description: str :param id: (Required) The ID of the certificate issuer. :type id: str :param issuer_attributes: General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :type issuer_attributes: dict :param issuer_type: (Required) The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. :type issuer_type: str :param name: (Required) Certificate issuer name, unique per account. :type name: str ''' pass @property def created_at(self): '''Creation UTC time RFC3339. api example: '2017-01-01T00:00:00Z' :rtype: datetime ''' pass @property def description(self): '''General description for the certificate issuer. api example: 'GlobalSign sample issuer' :rtype: str ''' pass @description.setter def description(self): '''Set value of `description` :param value: value to set :type value: str ''' pass @property def id(self): '''The ID of the certificate issuer. This field must be set when updating or deleting an existing CertificateIssuer Entity. api example: '01234567890ABCDEF01234567890ABCDEF' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def issuer_attributes(self): '''General attributes for connecting the certificate issuer. When the issuer_type is GLOBAL_SIGN, the value shall be empty. When the issuer_type is CFSSL_AUTH, see definition of CfsslAttributes. :rtype: dict ''' pass @issuer_attributes.setter def issuer_attributes(self): '''Set value of `issuer_attributes` :param value: value to set :type value: dict ''' pass @property def issuer_type(self): '''The type of the certificate issuer. - GLOBAL_SIGN: Certificates are issued by GlobalSign service. The users must provide their own GlobalSign account credentials. - CFSSL_AUTH: Certificates are issued by CFSSL authenticated signing service. The users must provide their own CFSSL host_url and credentials. This field must be set when creating a new CertificateIssuer Entity. api example: 'GLOBAL_SIGN' :rtype: str ''' pass @issuer_type.setter def issuer_type(self): '''Set value of `issuer_type` :param value: value to set :type value: str ''' pass @property def name(self): '''Certificate issuer name, unique per account. This field must be set when creating a new CertificateIssuer Entity. api example: 'GS Issuer' :rtype: str ''' pass @name.setter def name(self): '''Set value of `name` :param value: value to set :type value: str ''' pass def created_at(self): '''Create certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers>`_. :param issuer_credentials: The credentials required for connecting to the certificate issuer. When the issuer_type is GLOBAL_SIGN, see definition of GlobalSignCredentials. When the issuer_type is CFSSL_AUTH, see definition of CfsslAuthCredentials. :type issuer_credentials: dict :rtype: CertificateIssuer ''' pass def delete(self): '''Delete certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :rtype: CertificateIssuer ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Get certificate issuers list. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CertificateIssuer) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''Get certificate issuers list. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get certificate issuer by ID. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :rtype: CertificateIssuer ''' pass def update(self, issuer_credentials=None): '''Update certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}>`_. :param issuer_credentials: The credentials required for connecting to the certificate issuer. When the issuer_type is GLOBAL_SIGN, see definition of GlobalSignCredentials. When the issuer_type is CFSSL_AUTH, see definition of CfsslAuthCredentials. :type issuer_credentials: dict :rtype: CertificateIssuer ''' pass def verify(self): '''Verify certificate issuer. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/certificate-issuers/{certificate-issuer-id}/verify>`_. :rtype: VerificationResponse ''' pass
31
20
20
4
7
9
2
1.2
1
10
7
0
19
6
19
30
425
97
149
57
105
179
81
37
57
5
2
2
31
2,327
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/devices/device_events.py
mbed_cloud.foundation.entities.devices.device_events.DeviceEvents
class DeviceEvents(Entity): """Represents the `DeviceEvents` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "changes", "created_at", "data", "date_time", "description", "device_id", "event_type", "event_type_category", "event_type_description", "id", "state_change", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, changes=None, created_at=None, data=None, date_time=None, description=None, device_id=None, event_type=None, event_type_category=None, event_type_description=None, id=None, state_change=None, ): """Creates a local `DeviceEvents` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param changes: :type changes: dict :param created_at: :type created_at: datetime :param data: Additional data relevant to the event. :type data: dict :param date_time: :type date_time: datetime :param description: :type description: str :param device_id: :type device_id: str :param event_type: Event code :type event_type: str :param event_type_category: Category code which groups the event type by a summary category. :type event_type_category: str :param event_type_description: Generic description of the event :type event_type_description: str :param id: (Required) :type id: str :param state_change: :type state_change: bool """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._changes = fields.DictField(value=changes) self._created_at = fields.DateTimeField(value=created_at) self._data = fields.DictField(value=data) self._date_time = fields.DateTimeField(value=date_time) self._description = fields.StringField(value=description) self._device_id = fields.StringField(value=device_id) self._event_type = fields.StringField(value=event_type) self._event_type_category = fields.StringField(value=event_type_category) self._event_type_description = fields.StringField(value=event_type_description) self._id = fields.StringField(value=id) self._state_change = fields.BooleanField(value=state_change) @property def changes(self): """ :rtype: dict """ return self._changes.value @property def created_at(self): """ api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def data(self): """Additional data relevant to the event. api example: {'campaign_id': '00000000000000000000000000000000'} :rtype: dict """ return self._data.value @property def date_time(self): """ api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._date_time.value @property def description(self): """ api example: 'Device record created' :rtype: str """ return self._description.value @property def device_id(self): """ api example: '00000000000000000000000000000000' :rtype: str """ return self._device_id.value @property def event_type(self): """Event code api example: 'UPD2_100' :rtype: str """ return self._event_type.value @property def event_type_category(self): """Category code which groups the event type by a summary category. api example: 'FAIL_MANIFEST_REJECTED' :rtype: str """ return self._event_type_category.value @property def event_type_description(self): """Generic description of the event api example: 'FAIL' :rtype: str """ return self._event_type_description.value @property def id(self): """ This field must be set when updating or deleting an existing DeviceEvents Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def state_change(self): """ :rtype: bool """ return self._state_change.value def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """List all device events. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-events/>`_. **API Filters** The following filters are supported by the API when listing DeviceEvents entities: +--------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==============+======+======+======+======+======+======+======+ | date_time | | | Y | Y | Y | Y | | +--------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | device_id | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | event_type | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | state_change | Y | Y | | | | | | +--------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceEvents from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("date_time", "in", <filter value>) for device_event in DeviceEvents().list(filter=api_filter): print(device_event.date_time) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEvents) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import DeviceEvents from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=DeviceEvents._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = DeviceEvents._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=DeviceEvents, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """List all device events. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters query_params["after"] = fields.StringField(after).to_api() query_params["order"] = fields.StringField(order).to_api() query_params["limit"] = fields.IntegerField(limit).to_api() query_params["include"] = fields.StringField(include).to_api() return self._client.call_api( method="get", path="/v3/device-events/", content_type="application/json", query_params=query_params, unpack=False, ) def read(self): """Retrieve a device event. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-events/{device_event_id}/>`_. :rtype: DeviceEvents """ return self._client.call_api( method="get", path="/v3/device-events/{device_event_id}/", content_type="application/json", path_params={"device_event_id": self._id.to_api()}, unpack=self, )
class DeviceEvents(Entity): '''Represents the `DeviceEvents` entity in Pelion Device Management''' def __init__( self, _client=None, changes=None, created_at=None, data=None, date_time=None, description=None, device_id=None, event_type=None, event_type_category=None, event_type_description=None, id=None, state_change=None, ): '''Creates a local `DeviceEvents` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param changes: :type changes: dict :param created_at: :type created_at: datetime :param data: Additional data relevant to the event. :type data: dict :param date_time: :type date_time: datetime :param description: :type description: str :param device_id: :type device_id: str :param event_type: Event code :type event_type: str :param event_type_category: Category code which groups the event type by a summary category. :type event_type_category: str :param event_type_description: Generic description of the event :type event_type_description: str :param id: (Required) :type id: str :param state_change: :type state_change: bool ''' pass @property def changes(self): ''' :rtype: dict ''' pass @property def created_at(self): ''' api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def data(self): '''Additional data relevant to the event. api example: {'campaign_id': '00000000000000000000000000000000'} :rtype: dict ''' pass @property def date_time(self): ''' api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def description(self): ''' api example: 'Device record created' :rtype: str ''' pass @property def device_id(self): ''' api example: '00000000000000000000000000000000' :rtype: str ''' pass @property def event_type(self): '''Event code api example: 'UPD2_100' :rtype: str ''' pass @property def event_type_category(self): '''Category code which groups the event type by a summary category. api example: 'FAIL_MANIFEST_REJECTED' :rtype: str ''' pass @property def event_type_description(self): '''Generic description of the event api example: 'FAIL' :rtype: str ''' pass @property def id(self): ''' This field must be set when updating or deleting an existing DeviceEvents Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def state_change(self): ''' :rtype: bool ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''List all device events. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-events/>`_. **API Filters** The following filters are supported by the API when listing DeviceEvents entities: +--------------+------+------+------+------+------+------+------+ | Field | eq | neq | gte | lte | in | nin | like | +==============+======+======+======+======+======+======+======+ | date_time | | | Y | Y | Y | Y | | +--------------+------+------+------+------+------+------+------+ | description | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | device_id | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | event_type | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | id | Y | Y | | | Y | Y | | +--------------+------+------+------+------+------+------+------+ | state_change | Y | Y | | | | | | +--------------+------+------+------+------+------+------+------+ **Example Usage** .. code-block:: python from mbed_cloud.foundation import DeviceEvents from mbed_cloud import ApiFilter api_filter = ApiFilter() api_filter.add_filter("date_time", "in", <filter value>) for device_event in DeviceEvents().list(filter=api_filter): print(device_event.date_time) :param filter: An optional filter to apply when listing entities, please see the above **API Filters** table for supported filters. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type page_size: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(DeviceEvents) ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''List all device events. :param after: The ID of The item after which to retrieve the next page. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, `ASC` or `DESC`; by default `ASC`. :type order: str :param limit: How many objects to retrieve in the page. The minimum limit is 2 and the maximum is 1000. Limit values outside of this range are set to the closest limit. :type limit: int :param include: Comma-separated list of data fields to return. Currently supported: `total_count` :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Retrieve a device event. `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/device-events/{device_event_id}/>`_. :rtype: DeviceEvents ''' pass
29
17
19
4
6
9
1
1.27
1
9
6
0
16
11
16
27
365
88
122
62
76
155
61
36
41
5
2
2
21
2,328
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_resource_value_channel.py
tests.unit.asynchronous.test_resource_value_channel.Test
class Test(BaseCase): def test_invalid_wildcard(self): # can't have a wildcard in anything other than last character with self.assertRaises(ValueError): channels.ResourceValues(device_id='A*B*', resource_path=5) with self.assertRaises(ValueError): channels.ResourceValues(resource_path=['1', '**/']) def test_valid_wildcard(self): channel = channels.ResourceValues(device_id='AB') self.assertEqual({'channel': 'notifications', 'ep': ['AB']}, channel._route_seeds) channel = channels.ResourceValues(device_id=['A', 'B']) self.assertEqual({'channel': 'notifications', 'ep': ['A', 'B']}, channel._route_seeds) channel = channels.ResourceValues(device_id='AB*') self.assertEqual({'channel': 'notifications'}, channel._route_seeds) channel = channels.ResourceValues(device_id='A', resource_path='/3/0/1/*') self.assertEqual({'channel': 'notifications', 'ep': ['A']}, channel._route_seeds) self.assertEqual({'path': ['/3/0/1/*']}, channel._local_filters) channel = channels.ResourceValues(device_id=['a*', 'b'], resource_path=['/3/0/1/*', '4/*']) self.assertEqual({'channel': 'notifications'}, channel._route_seeds) self.assertEqual({'ep': ['a*', 'b'], 'path': ['/3/0/1/*', '4/*']}, channel._local_filters) def test_wildcards(self): # subscription to wildcard value should be triggered when receiving specific value device_id1 = 'ABCDEF' device_id2 = 'ABC123' subs = SubscriptionsManager(mock.MagicMock()) # channels A = subs.channels.ResourceValues(device_id=device_id1, resource_path=999) B = subs.channels.ResourceValues(device_id='ABCD*') C = subs.channels.ResourceValues(device_id='ABC*', resource_path=5) D = subs.channels.ResourceValues(device_id=device_id1, custom_attr='x') E = subs.channels.ResourceValues(device_id='*') F = subs.channels.ResourceValues(resource_path=[4, 5, 6, 7]) # set names for clarity of logging A.name = 'A' B.name = 'B' C.name = 'C' D.name = 'D' E.name = 'E' F.name = 'F' sequence = [A, B, C, D, E, F] # set up the channels for channel in sequence: subs.subscribe(channel) # notification payloads notifications = [ # device id matches ALL but doesn't match A, C, F because of resource paths, D due to custom attr ({'ep': device_id1}, (B, E)), # device id matches ALL but doesn't match A because of resource paths, D due to custom attr ({'ep': device_id1, 'path': '5'}, (B, C, E, F)), # should work as above ({'ep': device_id1, 'path': '5', 'unexpected': 'extra'}, (B, C, E, F)), # only matches D due to custom attr, E due to having any device id ({'ep': device_id1, 'custom_attr': 'x'}, (B, D, E)), # matches C and F due to resource path ({'ep': device_id2, 'path': '5'}, (C, E, F)), # should not trigger anything ({'endpoint': device_id1, 'custom_attr': 'x'}, tuple()), ] # trigger one-by-one for notification, expected_triggers in notifications: triggered = subs.notify({ channels.ChannelIdentifiers.notifications: [notification] }) expected_names = [c.name for c in expected_triggers] actual_names = [c.name for c in triggered] self.assertEqual(sorted(expected_names), sorted(actual_names)) # trigger in one go triggered = subs.notify({ channels.ChannelIdentifiers.notifications: [n[0] for n in notifications] }) all_expected_channels = [c.name for n in notifications for c in n[1]] actual_names = [c.name for c in triggered] self.assertEqual(sorted(all_expected_channels), sorted(actual_names)) self.assertEqual(8, B.observer.notify_count) self.assertEqual(2, D.observer.notify_count) def test_payload(self): # subscription to wildcard value should be triggered when receiving specific value device_id1 = 'ABCD_E' subs = SubscriptionsManager(mock.MagicMock()) observer_a = subs.subscribe(channels.ResourceValues(device_id=device_id1, resource_path='/10255/0/4')) subs.notify({ channels.ChannelIdentifiers.notifications: [ { "ct": "application/vnd.oma.lwm2m+tlv", "ep": device_id1, "max-age": 0, "path": "/10255/0/4", "payload": "iAsLSAAIAAAAAAAAAAA=", 'unexpected': 'extra', }, ], }) self.assertEqual(1, observer_a.notify_count) received_payload = observer_a.next().block(1) self.assertEqual( received_payload, { 'ct': 'application/vnd.oma.lwm2m+tlv', 'device_id': device_id1, 'max-age': 0, 'resource_path': '/10255/0/4', 'payload': {'11': {'0': 0}}, 'channel': 'notifications', 'unexpected': 'extra', } ) def test_parameters_as_lists(self): subs = SubscriptionsManager(mock.MagicMock()) observer_a = subs.subscribe(channels.ResourceValues(device_id='a', resource_path=['a', 'b'])) observer_b = subs.subscribe(channels.ResourceValues(device_id=['x', 'y'], resource_path=['a', 'b'])) subs.notify({ channels.ChannelIdentifiers.notifications: [ # should trigger A {'ep': 'a', 'path': 'a'}, # should trigger A {'ep': 'a', 'path': 'b'}, # should trigger B {'ep': 'x', 'path': 'b'}, ] }) self.assertEqual(2, observer_a.notify_count) self.assertEqual(1, observer_b.notify_count) @BaseCase._skip_in_ci def test_live_device_state_change(self): api = ConnectAPI() api.delete_presubscriptions() d = api.list_connected_devices().first() api.delete_device_subscriptions(d.id) channel = channels.ResourceValues(device_id=d.id, resource_path=['/3/0/*']) observer = api.subscribe(channel) # don't actually care about notifications, we want to see subscriptions current_subs = api.list_device_subscriptions(d.id) self.assertGreaterEqual(len(current_subs), 3) for path in current_subs: self.assertIn('/3/0', path) channel.stop() current_subs = api.list_device_subscriptions(d.id) self.assertIsNone(None, current_subs)
class Test(BaseCase): def test_invalid_wildcard(self): pass def test_valid_wildcard(self): pass def test_wildcards(self): pass def test_payload(self): pass def test_parameters_as_lists(self): pass @BaseCase._skip_in_ci def test_live_device_state_change(self): pass
8
0
26
3
20
3
2
0.16
1
6
4
0
6
0
6
78
161
23
119
39
111
19
79
38
72
3
3
1
9
2,329
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/channels/resource_values.py
mbed_cloud.subscribe.channels.resource_values.ResourceValues
class ResourceValues(ChannelSubscription): """Triggers when a resource's value changes""" def __init__( self, device_id=None, resource_path=None, first_value=FirstValue.on_value_update, **extra_filters ): """Triggers when a resource's value changes .. warning:: This functionality is considered experimental; the interface may change in future releases :param device_id: device identifier, (or list thereof), optionally ending with wildcard * :param resource_path: resource path, (or list thereof), optionally ending with wildcard * :param first_value: mode for adjusting immediacy of subscribed values :param extra_filters: other local key-value filters """ super(ResourceValues, self).__init__() self.device_ids = [str(d) for d in utils.ensure_listable(device_id) if d] self.resource_paths = [str(p) for p in utils.ensure_listable(resource_path) if p] # TODO(endpoint_type) support needs the endpoint_type or identifier in presub api response # self.endpoint_type self._immediacy = first_value self._presubscription_registry = None # type: PreSubscriptionRegistry # for filtering inbound notifications (with wildcards) self._local_filters = {} # for configuring the router (which has no wildcard behaviour) self._route_seeds = { 'channel': ChannelIdentifiers.notifications, } # turn our parameters into a presubscriptions-compatible list (one device id per entry) # note: pluralised 'resource_paths' self._sdk_presub_params = [ { k: v for k, v in dict( device_id=d, resource_paths=self.resource_paths ).items() if v } # API will not accept an empty pre-subscription, default wildcard match-all for d in self.device_ids or ["*"] ] # api sends back different field names on the notification channel so remap them before # putting them in the routing table for api_key_name, values in dict(ep=self.device_ids, path=self.resource_paths).items(): has_wildcards = any(self._is_wildcard(v) for v in values if v) for to_validate in values: if to_validate is None: continue if not self._validate_wildcard(to_validate): raise ValueError( 'Wildcards can only be used at the end of values: "%s"' % (to_validate,) ) # local filters recreate behaviour of server-side wildcard filter, but are not # routable (can't look them up in a dictionary) # routable filters are for explicit key-value pairs if has_wildcards: self._local_filters.setdefault(api_key_name, []).append(to_validate) else: self._route_seeds.setdefault(api_key_name, []).append(to_validate) self._route_keys = expand_dict_as_keys(self._route_seeds) self._optional_filters = {} self._optional_filters.update(extra_filters) self._optional_filter_keys = expand_dict_as_keys(self._optional_filters) self.add_filter_function(self._wildcard_filter) def _wildcard_filter(self, data): # custom local filtering based on wildcard string matches for each field for required_key, any_required_values in self._local_filters.items(): value = data.get(required_key) if value is None: # the filter key is missing from the data return False for required_value in any_required_values: if self._wildcard_match(str(value), required_value): break else: # no match from optional list: this data is not a match return False # every key has at least one matching value return True def _wildcard_match(self, candidate, expression): return candidate.startswith(expression[:-1]) def _validate_wildcard(self, item): return '*' not in item[:-1] def _is_wildcard(self, item): return item.endswith('*') def _pattern_match(self, item, pattern): """Determine whether the item supplied is matched by the pattern.""" if pattern.endswith('*'): return item.startswith(pattern[:-1]) else: return item == pattern def _matching_device_resources(self): device_resource_pairs = [] devices = self._api.list_connected_devices() LOG.debug('found %s connected device(s)', len(devices)) for device in devices: if self.device_ids and not any( self._pattern_match(device.id, filter_id) for filter_id in self.device_ids ): continue resources = self._api.list_resources(device.id) LOG.debug('found %s resource(s) on device %s', len(resources), device.id) for live_device_resource in resources: # Don't subscribe to resources which are not observable if not live_device_resource.observable: continue # If a wildcard matches then subscribe, default to wildcard match-all for filter_path in self.resource_paths or ["*"]: if self._pattern_match(live_device_resource.path, filter_path): # if we reach this point, we have matched this resource device_resource_pairs.append((device.id, live_device_resource.path)) break return device_resource_pairs def _subscribe_all_matching(self): device_resource_pairs = self._matching_device_resources() device_subscription_count = len(device_resource_pairs) if not device_subscription_count: LOG.warning('no matching devices and resources found, unable to auto-subscribe') elif device_subscription_count > 49: LOG.warning( 'auto-subscribing to a significant number of resources (%s), ' 'this may take some time', device_subscription_count ) else: LOG.debug('auto-subscribing to %s resources', device_subscription_count) for device, resource_path in device_resource_pairs: self._api._add_subscription(device, resource_path) def _unsubscribe_all_matching(self): device_resource_pairs = self._matching_device_resources() LOG.debug('removing subscriptions from %s resources', len(device_resource_pairs)) for device, resource_path in device_resource_pairs: self._api._delete_subscription(device, resource_path) @property def _presubs(self): if not self._presubscription_registry: self._presubscription_registry = PreSubscriptionRegistry(self._api) return self._presubscription_registry def start(self): """Start the channel""" super(ResourceValues, self).start() self._api.ensure_notifications_thread() self._presubs.add(self._sdk_presub_params) if self._immediacy == FirstValue.on_value_update: self._subscribe_all_matching() def _notify(self, data): decoded = {} decoded.update(data) decoded['payload'] = tlv.decode( payload=data.get('payload'), content_type=data.get('ct'), decode_b64=True ) for k, v in dict(ep='device_id', path='resource_path').items(): if k in decoded: decoded[v] = decoded.pop(k, None) super(ResourceValues, self)._notify(decoded) def stop(self): """Stop the channel""" self._presubs.remove(self._sdk_presub_params) if self._immediacy == FirstValue.on_value_update: self._unsubscribe_all_matching() super(ResourceValues, self).stop()
class ResourceValues(ChannelSubscription): '''Triggers when a resource's value changes''' def __init__( self, device_id=None, resource_path=None, first_value=FirstValue.on_value_update, **extra_filters ): '''Triggers when a resource's value changes .. warning:: This functionality is considered experimental; the interface may change in future releases :param device_id: device identifier, (or list thereof), optionally ending with wildcard * :param resource_path: resource path, (or list thereof), optionally ending with wildcard * :param first_value: mode for adjusting immediacy of subscribed values :param extra_filters: other local key-value filters ''' pass def _wildcard_filter(self, data): pass def _wildcard_match(self, candidate, expression): pass def _validate_wildcard(self, item): pass def _is_wildcard(self, item): pass def _pattern_match(self, item, pattern): '''Determine whether the item supplied is matched by the pattern.''' pass def _matching_device_resources(self): pass def _subscribe_all_matching(self): pass def _unsubscribe_all_matching(self): pass @property def _presubs(self): pass def start(self): '''Start the channel''' pass def _notify(self, data): pass def stop(self): '''Stop the channel''' pass
15
5
13
1
10
2
3
0.24
1
7
3
0
13
10
13
29
187
23
133
50
112
32
100
43
86
7
2
4
38
2,330
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/observer.py
mbed_cloud.subscribe.observer.Observer
class Observer(object): """An async stream generator (Future1, Future2, ... FutureN) This system should abstract async concepts to the end application so that native async logic can be used if available - awaitables/futures/callbacks or blocking behaviour on these """ sentinel = NoMoreNotifications() def __init__(self, filters=None, queue_size=0, once=False, provider=None, timeout=None): """Observer An iterable that manufactures results or promises for a stream of data Observer[1..n] gives promises for data stream [1..n] and fulfills them in that order :param filters: Additional key-value pairs to whitelist inbound notifications :param queue_size: sets internal notification queue max length :param once: only retrieve one item :param provider: :param timeout: """ # a notification storage queue that will grow if the user does not consume # inbound data, up to the queue size (after which, new data will be discarded) # this could be replaced with asyncio.Queue in py3 self._notifications = queue.Queue(maxsize=queue_size) self._once = once self._once_done = False self._timeout = timeout self._filters = filters self._lock = threading.Lock() # a queue of internally waitable objects self._waitables = queue.Queue() # provider is passed straight to the ConcurrentCall abstraction # if you are using asyncio you can pass your current event loop here and receive Futures # (although underneath this will still use an executor, until such time # as the library fully supports Py3 asyncio) self._async_wrapper_class = AsyncWrapper self._provider = provider # callbacks, if you want those instead self._callbacks = [] self._latest_item = None self._iter_count = 0 self._notify_count = 0 self._subscription_started = None self._cancelled = False @property def queue(self): """Direct access to the internal notification queue""" return self._notifications def __iter__(self): """Iterator""" return self def __next__(self): """Generates abstracted waitables (a new subscriber) They will be fulfilled in the order they were created, matching the order of new inbound notifications """ waitable = queue.Queue(maxsize=1) getter = functools.partial(waitable.get, timeout=self._timeout) self._latest_item = self._async_wrapper_class( func=getter, concurrency_provider=self._provider ) with self._lock: try: # get latest notification data = self._notifications.get_nowait() except queue.Empty: # store the consumer self._waitables.put(waitable) LOG.debug('no data for new consumer') else: # if we have a notification, pass it to the consumer immediately waitable.put_nowait(data) LOG.debug('new consumer taking next data immediately') return self._latest_item def next(self): """Next item in sequence (Python 2 compatibility)""" return self.__next__() def notify(self, data): """Notify this observer that data has arrived""" LOG.debug('notify received: %s', data) self._notify_count += 1 if self._cancelled: LOG.debug('notify skipping due to `cancelled`') return self if self._once_done and self._once: LOG.debug('notify skipping due to `once`') return self with self._lock: try: # notify next consumer immediately self._waitables.get_nowait().put_nowait(data) LOG.debug('found a consumer, notifying') except queue.Empty: # store the notification try: self._notifications.put_nowait(data) LOG.debug('no consumers, queueing data') except queue.Full: LOG.warning('notification queue full - discarding new data') # callbacks are sent straight away # bombproofing should be handled by individual callbacks for callback in self._callbacks: LOG.debug('callback: %s', callback) callback(data) self._once_done = True return self @property def notify_count(self): """Number of notifications received""" return self._notify_count def cancel(self): """Cancels the observer No more notifications will be passed on """ LOG.debug('cancelling %s', self) self._cancelled = True self.clear_callbacks() # not strictly necessary, but may release references while True: try: self._waitables.get_nowait().put_nowait(self.sentinel) except queue.Empty: break def add_callback(self, fn): """Register a callback, triggered when new data arrives As an alternative to callbacks, consider use of Futures or AsyncResults e.g. from `.next().defer()` """ self._callbacks.append(fn) return self def remove_callback(self, fn): """Remove a registered callback""" self._callbacks.remove(fn) return self def clear_callbacks(self): """Remove all callbacks""" self._callbacks[:] = [] return self
class Observer(object): '''An async stream generator (Future1, Future2, ... FutureN) This system should abstract async concepts to the end application so that native async logic can be used if available - awaitables/futures/callbacks or blocking behaviour on these ''' def __init__(self, filters=None, queue_size=0, once=False, provider=None, timeout=None): '''Observer An iterable that manufactures results or promises for a stream of data Observer[1..n] gives promises for data stream [1..n] and fulfills them in that order :param filters: Additional key-value pairs to whitelist inbound notifications :param queue_size: sets internal notification queue max length :param once: only retrieve one item :param provider: :param timeout: ''' pass @property def queue(self): '''Direct access to the internal notification queue''' pass def __iter__(self): '''Iterator''' pass def __next__(self): '''Generates abstracted waitables (a new subscriber) They will be fulfilled in the order they were created, matching the order of new inbound notifications ''' pass def next(self): '''Next item in sequence (Python 2 compatibility)''' pass def notify(self, data): '''Notify this observer that data has arrived''' pass @property def notify_count(self): '''Number of notifications received''' pass def cancel(self): '''Cancels the observer No more notifications will be passed on ''' pass def add_callback(self, fn): '''Register a callback, triggered when new data arrives As an alternative to callbacks, consider use of Futures or AsyncResults e.g. from `.next().defer()` ''' pass def remove_callback(self, fn): '''Remove a registered callback''' pass def clear_callbacks(self): '''Remove all callbacks''' pass
14
12
12
1
8
4
2
0.57
1
2
1
0
11
15
11
11
161
25
87
34
73
50
82
32
70
6
1
3
19
2,331
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/test_self_server.py
tests.integration.test_self_server.Test
class Test(BaseCase): server = None instance = [] @classmethod def setUpClass(cls): cls.server = new_server_process(coverage=False) @property def idee(self): return self.instance[0] def test_ping_pong(self): self.assertIsNone(self.server.poll()) self.assertEqual(requests.get(server_addr + '/ping', timeout=(15, 15)).json(), 'pong') def test_shutdown(self): response = requests.post(server_addr + '/shutdown') response.raise_for_status() for _ in range(50): time.sleep(0.02) result = self.server.poll() if result is not None: break self.assertEqual(result, 0) @classmethod def tearDownClass(cls): cls.server.kill()
class Test(BaseCase): @classmethod def setUpClass(cls): pass @property def idee(self): pass def test_ping_pong(self): pass def test_shutdown(self): pass @classmethod def tearDownClass(cls): pass
9
0
4
0
4
0
1
0
1
1
0
0
3
0
5
77
29
5
24
14
15
0
21
11
15
3
3
2
7
2,332
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/test_server.py
tests.integration.test_server.EndpointTests
class EndpointTests(unittest.TestCase): @classmethod def setUpClass(cls): """Setup standard test client for flask apps""" cls.app = app.test_client() # When run locally this will use the default environment variables, when running in CI use the OS2 # defaults for this test as it contacts the API to list the user entity. sdk_config = {} try: sdk_config["api_key"] = os.environ['TEST_RUNNER_DEFAULT_API_KEY'] except KeyError: pass try: sdk_config["host"] = os.environ['TEST_RUNNER_DEFAULT_API_HOST'] except KeyError: pass cls.sdk_config = json.dumps(sdk_config) def create_instance(self, url): """Create a module, entity or SDK instance.""" return self.app.post(url, data=self.sdk_config, content_type='application/json') def test_ping(self): response = self.app.get('/ping') self.assertEqual(response.status_code, 200) def test_reset(self): response = self.app.post('/reset') self.assertEqual(response.status_code, 205) def test_modules(self): response = self.app.get('/modules') self.assertEqual(response.status_code, 200) self.assertTrue(isinstance(response.json, list)) def test_module_instances(self): module = "update" # Get a list of instances that already exist response = self.app.get('/modules/%s/instances' % module) self.assertEqual(response.status_code, 200) starting_instance_count = len(response.json) # Create a new instance response = self.create_instance('/modules/%s/instances' % module) self.assertEqual(response.status_code, 201) instance_id = response.json["id"] response = self.app.get('/modules/%s/instances' % module) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count + 1, "Created instance should be in the list.") # Delete created instance response = self.app.delete('/instances/%s' % instance_id) self.assertEqual(response.status_code, 200) # Check instance has been deleted from the list response = self.app.get('/modules/%s/instances' % module) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count, "Instance should not be in the list.") def test_unknown_module(self): module = "unknown" # Attempt to create an instance for a module that doesn't exist response = self.create_instance('/modules/%s/instances' % module) self.assertEqual(response.status_code, 404) def test_module_methods(self): module = "update" # Create a new instance response = self.create_instance('/modules/%s/instances' % module) self.assertEqual(response.status_code, 201) instance_id = response.json["id"] # Check methods can be listed response = self.app.get('/instances/%s/methods' % instance_id) self.assertEqual(response.status_code, 200) self.assertTrue(isinstance(response.json, list)) def test_entities(self): response = self.app.get('/foundation/entities') self.assertEqual(response.status_code, 200) self.assertTrue(isinstance(response.json, list)) def test_entity_methods(self): entity = "User" # Create a new instance response = self.create_instance('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 201) instance_id = response.json["id"] # Check methods can be listed response = self.app.get('/foundation/instances/%s/methods' % instance_id) self.assertEqual(response.status_code, 200) self.assertTrue(isinstance(response.json, list)) response = self.app.post('/foundation/instances/%s/methods/list' % instance_id) self.assertEqual(response.status_code, 200, str(response.json)) response = self.app.post('/foundation/instances/%s/methods/unknown' % instance_id) self.assertEqual(response.status_code, 404) def test_entity_parameters(self): entity = "User" # Create a new instance response = self.create_instance('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 201) instance_id = response.json["id"] response = self.app.post('/foundation/instances/%s/methods/list' % instance_id) self.assertEqual(response.status_code, 200, str(response.json)) # Clean up test user if it already exists as it could be left over in the event of a test failure for user in response.json["payload"]: if user["email"] == "[email protected]": response = self.app.post( '/foundation/instances/%s/methods/delete' % instance_id, data=json.dumps({"user_id": user["id"]}), content_type='application/json' ) self.assertEqual(response.status_code, 200, str(response.json)) # There should only be one user with that email address for break out of loop # break # Create a new user with parameters create_parameters = { # Entity parameters "email": "[email protected]", "full_name": "Mr Python SDK-Test-Server", "password": "secret01", "username": "python_sdk_test_server", # Method parameter "action": "create", } response = self.app.post( '/foundation/instances/%s/methods/create' % instance_id, data=json.dumps(create_parameters), content_type='application/json' ) self.assertEqual(response.status_code, 200, str(response.json)) # Delete created user, there should be no need to supply the ID as it should already be saved in the instance. response = self.app.post('/foundation/instances/%s/methods/delete' % instance_id) self.assertEqual(response.status_code, 200, str(response.json)) def test_sdk_methods(self): # Create a new instance response = self.create_instance('/foundation/sdk/instances') self.assertEqual(response.status_code, 201) instance_id = response.json["id"] # Check methods can be listed response = self.app.get('/foundation/instances/%s/methods' % instance_id) self.assertEqual(response.status_code, 200) self.assertTrue(isinstance(response.json, list)) # SDK methods should not be executable response = self.app.post('/foundation/instances/%s/methods/foundation' % instance_id) self.assertEqual(response.status_code, 405) def test_sdk_instances(self): # Get a list of instances that already exist response = self.app.get('/foundation/sdk/instances') self.assertEqual(response.status_code, 200) starting_instance_count = len(response.json) # Create a new instance response = self.create_instance('/foundation/sdk/instances') self.assertEqual(response.status_code, 201) instance_id = response.json["id"] response = self.app.get('/foundation/sdk/instances') self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count + 1, "Created instance should be in the list.") # Delete created instance response = self.app.delete('/foundation/instances/%s' % instance_id) self.assertEqual(response.status_code, 204) # Check instance has been deleted from the list response = self.app.get('/foundation/sdk/instances') self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count, "Instance should not be in the list.") def test_entity_instances(self): entity = "User" # Get a list of instances that already exist response = self.app.get('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 200) starting_instance_count = len(response.json) # Create a new instance response = self.create_instance('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 201) instance_id = response.json["id"] response = self.app.get('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count + 1, "Created instance should be in the list.") # Delete created instance response = self.app.delete('/foundation/instances/%s' % instance_id) self.assertEqual(response.status_code, 204) # Check instance has been deleted from the list response = self.app.get('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), starting_instance_count, "Instance should not be in the list.") def test_unknown_entity(self): entity = "unknown" # Attempt to create an instance for an entity that doesn't exist response = self.create_instance('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 404) def test_instances_listing(self): """Test that the instance list endpoint only list appropriate entities.""" entity = "User" module = "update" response = self.app.get('/foundation/instances') self.assertEqual(response.status_code, 200) foundation_instance_count = len(response.json) response = self.app.get('/instances') self.assertEqual(response.status_code, 200) module_instance_count = len(response.json) # Create a new top level SDK instance response = self.create_instance('/foundation/sdk/instances') self.assertEqual(response.status_code, 201) # Create a new Foundation entity instance response = self.create_instance('/foundation/entities/%s/instances' % entity) self.assertEqual(response.status_code, 201) # Create a new module instance response = self.create_instance('/modules/%s/instances' % module) self.assertEqual(response.status_code, 201) # The instance list endpoint for foundation should not include module instances response = self.app.get('/foundation/instances') self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), foundation_instance_count + 2, "There should be two additional instances.") # The instance list endpoint for modules should not include foundation instances response = self.app.get('/instances') self.assertEqual(response.status_code, 200) self.assertEqual(len(response.json), module_instance_count + 1, "There should be one additional instance.") def test_unknown_foundation_instance(self): instance_id = "unknown" # Attempt to get an instance for a foundation entity that doesn't exist response = self.app.get('/foundation/instances/%s' % instance_id) self.assertEqual(response.status_code, 404) def test_unknown_module_instance(self): instance_id = "unknown" # Attempt to get an instance for a foundation entity that doesn't exist response = self.app.get('/instances/%s' % instance_id) self.assertEqual(response.status_code, 404)
class EndpointTests(unittest.TestCase): @classmethod def setUpClass(cls): '''Setup standard test client for flask apps''' pass def create_instance(self, url): '''Create a module, entity or SDK instance.''' pass def test_ping(self): pass def test_reset(self): pass def test_modules(self): pass def test_module_instances(self): pass def test_unknown_module(self): pass def test_module_methods(self): pass def test_entities(self): pass def test_entity_methods(self): pass def test_entity_parameters(self): pass def test_sdk_methods(self): pass def test_sdk_instances(self): pass def test_entity_instances(self): pass def test_unknown_entity(self): pass def test_instances_listing(self): '''Test that the instance list endpoint only list appropriate entities.''' pass def test_unknown_foundation_instance(self): pass def test_unknown_module_instance(self): pass
20
3
14
2
10
2
1
0.24
1
3
0
0
17
1
18
90
268
54
173
63
153
41
158
61
139
3
2
2
22
2,333
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/test_with_rpc.py
tests.integration.test_with_rpc.TestWithRPC
class TestWithRPC(BaseCase): process = None def setUp(self): self.process = new_server_process() logging.basicConfig(level=logging.INFO) def test_run(self): timeout_check_output(process=self.process, timeout=9*60) self.process.wait() LOG.info('Test server was shut down') # now go to the rpc test result directory and load outcome for i in range(10): if os.path.exists('results/results.xml'): break time.sleep(0.2) else: raise IOError('could not find integration results') self.outcome = ElementTree.parse('results/results.xml').getroot().attrib for outcome in {'errors', 'failures'}: remote_value = int(self.outcome.get(outcome, 0)) if remote_value: self.fail('Remote test had %s %s' % (remote_value, outcome))
class TestWithRPC(BaseCase): def setUp(self): pass def test_run(self): pass
3
0
11
2
9
1
3
0.05
1
2
0
0
2
1
2
74
27
6
20
8
17
1
20
8
17
5
3
2
6
2,334
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/performance/test_channel_performance.py
tests.performance.test_channel_performance.Test
class Test(BaseCase): @classmethod def setUpClass(cls): setup = inspect.getsource(bench) number = 500 cls.bench = timeit.timeit(stmt='bench(1000)', setup=setup, number=number) / number def test_routing_performance(self): subs = SubscriptionsManager(mock.MagicMock()) sample_id = 42 sample = None # register a bunch of subscribers for i in range(1000): subs.subscribe(channels.ResourceValues(device_id=i)) obs = subs.subscribe(channels.ResourceValues(device_id=i, resource_path=['/3/0/*', '/4/0/1'])) if i == sample_id: sample = obs subs.subscribe(channels.ResourceValues(**{'device_id': i, str(i): 'abc'})) notification_count = 33 start = timeit.default_timer() for i in range(notification_count): subs.notify({'notifications': [{'endpoint-name': str(42), 'resource-path': '/3/0/1'}]}) subs.notify({'notifications': [{'endpoint-name': str(42), 'resource-path': '/3/1'}]}) subs.notify({'notifications': [{'endpoint-name': str(5), 'resource-path': '/3/1'}]}) stop = timeit.default_timer() duration = stop - start self.assertEqual(notification_count, sample.notify_count) # mildly contrived, but for cross-machine consistency we need # to use a benchmark to compare the lookup performance with self.assertLess(duration, 100 * self.bench)
class Test(BaseCase): @classmethod def setUpClass(cls): pass def test_routing_performance(self): pass
4
0
15
1
12
2
3
0.12
1
4
2
0
1
0
2
74
32
3
26
15
22
3
25
14
22
4
3
2
5
2,335
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/performance/test_threaded_async.py
tests.performance.test_threaded_async.Test
class Test(BaseCase): def test(self): api = ConnectAPI() device = api.list_connected_devices().first() start = threading.Event() threads = [] for i in range(20): t = threading.Thread(target=worker, args=(i, start, api, device, 100)) t.daemon = True t.start() threads.append(t) start.set() [t.join() for t in threads]
class Test(BaseCase): def test(self): pass
2
0
12
0
12
0
2
0
1
4
1
0
1
0
1
73
13
0
13
8
11
0
13
8
11
2
3
1
2
2,336
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/performance/test_threaded_connect.py
tests.performance.test_threaded_connect.Test
class Test(BaseCase): """Checks for #499 in which multiple concurrent calls somehow use the wrong config This was historically caused by `TypeWithDefault` from swagger codegen which tries to make config objects into module-wide singletons. """ def test_concurrent_config(self): n = 50 so_many_threads = ThreadPool(processes=n//2) start = threading.Event() results = [] for i in range(n): so_many_threads.apply_async(worker, args=(start, str(i), results)) so_many_threads.close() # no more submissions time.sleep(1.0) # wait for threads to get set up. we'd like a thundering herd. # (not as clean as managing threads ourselves) start.set() # start! so_many_threads.join() # wait for all tasks to complete failures = [i for i in range(n) if results.count(str(i)) != 1] print(results) self.assertFalse(failures)
class Test(BaseCase): '''Checks for #499 in which multiple concurrent calls somehow use the wrong config This was historically caused by `TypeWithDefault` from swagger codegen which tries to make config objects into module-wide singletons. ''' def test_concurrent_config(self): pass
2
1
17
2
14
5
2
0.6
1
4
0
0
1
0
1
73
23
3
15
8
13
9
15
8
13
2
3
1
2
2,337
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/static/test_imports.py
tests.static.test_imports.Test
class Test(BaseCase): """Verify high level APIs are importable in the expected manner""" def test_account(self): from mbed_cloud import AccountManagementAPI from mbed_cloud.account_management import User from mbed_cloud.account_management import Group from mbed_cloud.account_management import ApiKey from mbed_cloud.account_management import AccountManagementAPI def test_certs(self): from mbed_cloud import CertificatesAPI from mbed_cloud.certificates import Certificate from mbed_cloud.certificates import CertificateType def test_connect(self): from mbed_cloud import ConnectAPI from mbed_cloud.connect import AsyncConsumer from mbed_cloud.connect import Resource from mbed_cloud.connect import Webhook def test_device(self): from mbed_cloud import DeviceDirectoryAPI from mbed_cloud.device_directory import Device from mbed_cloud.device_directory import DeviceEvent from mbed_cloud.device_directory import Query def test_update(self): from mbed_cloud import UpdateAPI from mbed_cloud.update import Campaign from mbed_cloud.update import FirmwareImage from mbed_cloud.update import FirmwareManifest def test_enrollment(self): from mbed_cloud import EnrollmentAPI from mbed_cloud.enrollment import EnrollmentAPI from mbed_cloud.enrollment import EnrollmentClaim def test_bootstrap(self): from mbed_cloud import BootstrapAPI from mbed_cloud.bootstrap import BootstrapAPI from mbed_cloud.bootstrap import PreSharedKey def test_z_object_attr_maps(self): # check attribute counts align (run last - after importing all packages) from mbed_cloud.core import BaseObject all_objs_classes = BaseObject.__subclasses__() # check if the BaseObject child class count changed self.assertEqual(len(all_objs_classes), 19) fail = {} for obj in all_objs_classes: attr_map = obj._get_attributes_map() in_attr_map_not_object = [k for k in attr_map if not hasattr(obj, k)] in_object_not_attr_map = [k for k in vars(obj) if (not k.startswith('_') and k not in attr_map)] if in_attr_map_not_object or in_object_not_attr_map: fail[str(obj)] = dict(missing=in_attr_map_not_object, excess=in_object_not_attr_map) if fail: raise self.failureException('mapped fields are wrong.\n%s' % (fail,))
class Test(BaseCase): '''Verify high level APIs are importable in the expected manner''' def test_account(self): pass def test_certs(self): pass def test_connect(self): pass def test_device(self): pass def test_update(self): pass def test_enrollment(self): pass def test_bootstrap(self): pass def test_z_object_attr_maps(self): pass
9
1
6
0
6
0
1
0.06
1
24
22
0
8
0
8
80
58
8
47
42
11
3
47
42
11
4
3
2
11
2,338
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/static/test_self_metrics.py
tests.static.test_self_metrics.Flake8Error
class Flake8Error(Exception): pass
class Flake8Error(Exception): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
10
2
0
2
1
1
0
2
1
1
0
3
0
0
2,339
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/static/test_self_metrics.py
tests.static.test_self_metrics.TestSelfMetrics
class TestSelfMetrics(BaseCase): def test_self_metrics(self): try: subprocess.check_output( [sys.executable, '-m', 'flake8', '.'], cwd=self._project_root_dir, stderr=subprocess.PIPE ) except subprocess.CalledProcessError as e: try: indented = re_render(e.output.decode('utf8')) except Exception as e: indented = '<Failed to parse flake8 output: %s>' % e raise Flake8Error('Saw flake8 failures running in %s:\n%s' % (self._project_root_dir, indented))
class TestSelfMetrics(BaseCase): def test_self_metrics(self): pass
2
0
13
0
13
0
3
0
1
3
1
0
1
1
1
73
14
0
14
5
12
0
10
3
8
3
3
2
3
2,340
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test2
class Test2(AsyncBase): def setUp(self): super(Test2, self).setUp() from tests.unit.asynchronous.blocking_call import slow self.AsyncWrapper = AsyncWrapper(func=slow) def get_async_value(self, defer): return defer.get()
class Test2(AsyncBase): def setUp(self): pass def get_async_value(self, defer): pass
3
0
3
0
3
0
1
0
1
1
0
1
2
1
2
80
8
1
7
5
3
0
7
5
3
1
4
0
2
2,341
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test2CustomLoop
class Test2CustomLoop(Test2): def setUp(self): super(Test2CustomLoop, self).setUp() from tests.unit.asynchronous.blocking_call import slow tp = pool.ThreadPool(processes=1) self.AsyncWrapper = AsyncWrapper(concurrency_provider=tp, func=slow)
class Test2CustomLoop(Test2): def setUp(self): pass
2
0
5
0
5
0
1
0
1
2
0
0
1
1
1
81
6
0
6
5
3
0
6
5
3
1
5
0
1
2,342
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_security.py
tests.integration.foundation.test_security.TestTrustedandDeveloperCertificate
class TestTrustedandDeveloperCertificate(BaseCase, CrudMixinTests): """Test certificates in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = TrustedCertificate super(TestTrustedandDeveloperCertificate, cls).setUpClass() def test_certificate_info(self): for trusted_cert in TrustedCertificate().list(): # Check name is set and of a sensible type self.assertIsInstance(trusted_cert.name, str, "Expected a certification name to be a string") self.assertTrue(len(trusted_cert.name) > 0, "Expected a certificate to have a non zero length name") if trusted_cert.is_developer_certificate: # If this is a developer certificate retrieve it developer_certificate = trusted_cert.get_developer_certificate_info() self.assertEqual(developer_certificate.__class__.__name__, "DeveloperCertificate") new_developer_certificate = DeveloperCertificate(id=developer_certificate.id) # Test the link back to the trusted certificate back_linked_cert = new_developer_certificate.get_trusted_certificate_info() self.assertEqual(back_linked_cert.__class__.__name__, "TrustedCertificate") self.assertEqual(trusted_cert.id, back_linked_cert.id, "These should be the same trusted certificate") else: # If this is not a developer certificate check that it cannot be retrieved with self.assertRaises(ApiErrorResponse) as api_error: trusted_cert.get_developer_certificate_info() self.assertEqual(api_error.exception.status_code, 404)
class TestTrustedandDeveloperCertificate(BaseCase, CrudMixinTests): '''Test certificates in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_certificate_info(self): pass
4
1
12
1
9
2
2
0.25
2
5
3
0
1
0
2
76
29
4
20
9
16
5
18
7
15
3
3
3
4
2,343
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test3
class Test3(AsyncBase): loop = None def setUp(self): super().setUp() import asyncio from tests.unit.asynchronous.awaitable_call import slow self.target = slow self.loop = asyncio.get_event_loop() self.AsyncWrapper = AsyncWrapper(concurrency_provider=self.loop, func=self.target) def get_async_value(self, defer): return self.loop.run_until_complete(defer)
class Test3(AsyncBase): def setUp(self): pass def get_async_value(self, defer): pass
3
0
5
0
5
0
1
0
1
1
0
3
2
2
2
80
13
2
11
8
6
0
11
8
6
1
4
0
2
2,344
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test3CustomLoop
class Test3CustomLoop(Test3): def setUp(self): super().setUp() import asyncio self.loop = asyncio.new_event_loop() self.AsyncWrapper = AsyncWrapper(concurrency_provider=self.loop, func=self.target)
class Test3CustomLoop(Test3): def setUp(self): pass
2
0
5
0
5
0
1
0
1
1
0
1
1
2
1
81
6
0
6
5
3
0
6
5
3
1
5
0
1
2,345
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test3CustomWrongLoop
class Test3CustomWrongLoop(Test3CustomLoop): def setUp(self): super().setUp() import asyncio # silly us, we used a different loop compared to our testing code! this won't work. self.AsyncWrapper = AsyncWrapper(concurrency_provider=asyncio.new_event_loop(), func=self.target) def test_async(self): with self.assertRaises(ValueError): super().test_async()
class Test3CustomWrongLoop(Test3CustomLoop): def setUp(self): pass def test_async(self): pass
3
0
4
0
4
1
1
0.13
1
2
0
0
2
1
2
83
10
1
8
5
4
1
8
5
4
1
6
1
2
2,346
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test3DoesThreadsToo
class Test3DoesThreadsToo(Test3): def setUp(self): super().setUp() # if we wanted to, we could make our AsyncWrapper use ThreadPools in python3. from tests.unit.asynchronous.blocking_call import slow self.target = slow tp = pool.ThreadPool(processes=1) self.AsyncWrapper = AsyncWrapper(concurrency_provider=tp, func=self.target) def get_async_value(self, defer): return defer.get()
class Test3DoesThreadsToo(Test3): def setUp(self): pass def get_async_value(self, defer): pass
3
0
5
0
4
1
1
0.11
1
2
0
0
2
2
2
82
11
1
9
7
5
1
9
7
5
1
5
0
2
2,347
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_current_resource_value.py
tests.unit.asynchronous.test_current_resource_value.Test
class Test(BaseCase): def test_current_resource_value(self): device_id1 = 'ABCD_E' device_id2 = 'ABCD_F' resource_path = '/3/4/5' subs = SubscriptionsManager(mock.MagicMock()) channel_a = channels.CurrentResourceValue(device_id=device_id1, resource_path=resource_path) observer_a = subs.subscribe(channel_a) channel_b = channels.CurrentResourceValue(device_id=device_id2, resource_path=resource_path) observer_b = subs.subscribe(channel_b) subs.notify({ channels.ChannelIdentifiers.async_responses: [ {'id': channel_a.async_id}, {'id': 'unlikely'}, ] }) self.assertEqual(1, observer_a.notify_count) self.assertEqual(0, observer_b.notify_count) @BaseCase._skip_in_ci def test_live_device_state_change(self): api = ConnectAPI() d = api.list_connected_devices().first() api.delete_device_subscriptions(d.id) # request the `manufacturer` field channel = channels.CurrentResourceValue(device_id=d.id, resource_path='/3/0/0') observer = api.subscribe(channel) value = observer.next().block(timeout=2) # should be, in this case, TLV self.assertEqual(b'6465765f6d616e756661637475726572', value)
class Test(BaseCase): def test_current_resource_value(self): pass @BaseCase._skip_in_ci def test_live_device_state_change(self): pass
4
0
15
2
13
1
1
0.07
1
4
4
0
2
0
2
74
34
5
27
17
23
2
21
16
18
1
3
0
2
2,348
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_expand_dict.py
tests.unit.asynchronous.test_expand_dict.Test
class Test(BaseCase): def test_empty(self): self.assertEqual(expand_dict_as_keys(dict()), [ tuple() ]) def test_static(self): self.assertEqual(expand_dict_as_keys(dict(a=1, b=2)), [ tuple([('a', 1), ('b', 2)]) ]) def test_static_sorted(self): self.assertEqual(expand_dict_as_keys(dict(c=1, b=2)), [ tuple([('b', 2), ('c', 1)]) ]) def test_expand(self): self.assertEqual(expand_dict_as_keys(dict(a=1, b=[2, 3])), [ tuple([('a', 1), ('b', 2)]), tuple([('a', 1), ('b', 3)]), ]) def test_product(self): self.assertEqual(expand_dict_as_keys(dict(a=1, b=[2, 3], c=[4, 5])), [ tuple([('a', 1), ('b', 2), ('c', 4)]), tuple([('a', 1), ('b', 2), ('c', 5)]), tuple([('a', 1), ('b', 3), ('c', 4)]), tuple([('a', 1), ('b', 3), ('c', 5)]), ]) def test_usage(self): keys = set(expand_dict_as_keys(dict(a=1, b=[2, 3], c=[4, 5]))) self.assertIn(expand_dict_as_keys(dict(a=1, b=2, c=5))[0], keys) self.assertNotIn(expand_dict_as_keys(dict(a=1, b=2, c=6))[0], keys)
class Test(BaseCase): def test_empty(self): pass def test_static(self): pass def test_static_sorted(self): pass def test_expand(self): pass def test_product(self): pass def test_usage(self): pass
7
0
5
0
5
0
1
0
1
3
0
0
6
0
6
78
35
6
29
8
22
0
15
8
8
1
3
0
6
2,349
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_observers.py
tests.unit.asynchronous.test_observers.Test
class Test(BaseCase): def test_subscribe_first(self): obs = Observer() a = obs.next() b = obs.next() obs.notify('a') obs.notify('b') obs.notify('c') self.assertNotEqual(a, b) self.assertEqual(a.block(DEFAULT_TIMEOUT), 'a') self.assertEqual(b.block(DEFAULT_TIMEOUT), 'b') def test_notify_first(self): obs = Observer() obs.notify('a') obs.notify('b') obs.notify('c') a = obs.next() b = obs.next() self.assertNotEqual(a, b) self.assertEqual(a.block(DEFAULT_TIMEOUT), 'a') self.assertEqual(b.block(DEFAULT_TIMEOUT), 'b') def test_interleaved(self): obs = Observer() obs.notify('a') a = obs.next() b = obs.next() c = obs.next() obs.notify('b') d = obs.next() obs.notify('c') obs.notify('d') obs.notify('e') e = obs.next() self.assertEqual(a.block(DEFAULT_TIMEOUT), 'a') self.assertEqual(b.block(DEFAULT_TIMEOUT), 'b') self.assertEqual(c.block(DEFAULT_TIMEOUT), 'c') self.assertEqual(d.block(DEFAULT_TIMEOUT), 'd') self.assertEqual(e.block(DEFAULT_TIMEOUT), 'e') def test_stream(self): """Looping over the observer with iteration""" obs = Observer() n = 7 # we stream some new values for i in range(n): obs.notify(dict(i=i)) # and we can read from them asynchronously items = [] for new_item in itertools.islice(obs, 0, n-1): items.append(new_item.block(DEFAULT_TIMEOUT).get('i')) self.assertEqual(items, list(range(6))) def test_threaded_stream(self): """Behaviour in threaded environment""" obs = Observer() n = 15 start = threading.Event() sleepy = lambda: random.randrange(1, 3) / 1000.0 def add_values(): start.wait() for i in range(n): obs.notify(dict(a_key=i)) time.sleep(sleepy()) add = threading.Thread(target=add_values) add.daemon = True add.start() def read_values(result): start.wait() # finite iteration of infinite generator for new_item in itertools.islice(obs, 0, n - 1): result.append(new_item.block(timeout=DEFAULT_TIMEOUT).get('a_key')) time.sleep(sleepy()) results = [] read = threading.Thread(target=read_values, args=(results,)) read.daemon = True read.start() start.set() add.join(timeout=2*DEFAULT_TIMEOUT) read.join(timeout=2*DEFAULT_TIMEOUT) self.assertFalse(add.isAlive()) self.assertFalse(read.isAlive()) # the sequence of values from all the subscribers # should be in the same order as the data was added self.assertEqual(results, list(range(n-1))) def test_callback(self): """Callback is triggered on notification""" x = dict(a=1) def incr(n): x['a'] += n obs = Observer() obs.add_callback(incr) obs.notify(3) self.assertEqual(x, dict(a=4)) def test_callback_add_remove_clear(self): """Callbacks can be added and removed""" f = lambda: 5 g = lambda: 6 obs = Observer() obs.add_callback(f) obs.add_callback(g) obs.remove_callback(f) self.assertEqual(obs._callbacks, [g]) obs.clear_callbacks() self.assertEqual(obs._callbacks, []) def test_overflow(self): """Inbound queue overflows""" obs = Observer(queue_size=1) obs.notify(1) if six.PY3: with self.assertLogs(level=logging.WARNING): obs.notify(1) obs.notify(1) self.assertTrue(obs.next().defer().get(timeout=DEFAULT_TIMEOUT)) # The second waiter will never resolve because the queue was too short waiter = obs.next().defer() waiter.wait(0.05) self.assertFalse(waiter.ready())
class Test(BaseCase): def test_subscribe_first(self): pass def test_notify_first(self): pass def test_interleaved(self): pass def test_stream(self): '''Looping over the observer with iteration''' pass def test_threaded_stream(self): '''Behaviour in threaded environment''' pass def add_values(): pass def read_values(result): pass def test_callback(self): '''Callback is triggered on notification''' pass def incr(n): pass def test_callback_add_remove_clear(self): '''Callbacks can be added and removed''' pass def test_overflow(self): '''Inbound queue overflows''' pass
12
5
13
1
10
1
1
0.11
1
7
1
0
8
0
8
80
135
20
104
45
92
11
104
45
92
3
3
2
16
2,350
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/campaign_statistics_events.py
mbed_cloud.foundation.entities.device_update.campaign_statistics_events.CampaignStatisticsEvents
class CampaignStatisticsEvents(Entity): """Represents the `CampaignStatisticsEvents` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "campaign_id", "count", "created_at", "description", "event_type", "id", "summary_status", "summary_status_id", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__( self, _client=None, campaign_id=None, count=None, created_at=None, description=None, event_type=None, id=None, summary_status=None, summary_status_id=None, ): """Creates a local `CampaignStatisticsEvents` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param description: :type description: str :param event_type: :type event_type: str :param id: (Required) :type id: str :param summary_status: :type summary_status: str :param summary_status_id: (Required) :type summary_status_id: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._campaign_id = fields.StringField(value=campaign_id) self._count = fields.IntegerField(value=count) self._created_at = fields.DateTimeField(value=created_at) self._description = fields.StringField(value=description) self._event_type = fields.StringField(value=event_type) self._id = fields.StringField(value=id) self._summary_status = fields.StringField(value=summary_status) self._summary_status_id = fields.StringField(value=summary_status_id) @property def campaign_id(self): """ID of the associated campaign. This field must be set when creating a new CampaignStatisticsEvents Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._campaign_id.value @campaign_id.setter def campaign_id(self, value): """Set value of `campaign_id` :param value: value to set :type value: str """ self._campaign_id.set(value) @property def count(self): """ api example: 10 :rtype: int """ return self._count.value @property def created_at(self): """ api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def description(self): """ api example: 'Update error, nonspecific network error' :rtype: str """ return self._description.value @property def event_type(self): """ api example: 'UPD4_FAIL_101' :rtype: str """ return self._event_type.value @property def id(self): """ This field must be set when updating or deleting an existing CampaignStatisticsEvents Entity. api example: 'upd_fail_101' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def summary_status(self): """ api example: 'FAIL' :rtype: str """ return self._summary_status.value @property def summary_status_id(self): """ This field must be set when creating a new CampaignStatisticsEvents Entity. api example: 'fail' :rtype: str """ return self._summary_status_id.value @summary_status_id.setter def summary_status_id(self, value): """Set value of `summary_status_id` :param value: value to set :type value: str """ self._summary_status_id.set(value) def read(self): """Get an event type for a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/{event_type_id}>`_. :rtype: CampaignStatisticsEvents """ return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/{event_type_id}", content_type="application/json", path_params={ "campaign_id": self._campaign_id.to_api(), "event_type_id": self._id.to_api(), "summary_status_id": self._summary_status_id.to_api(), }, unpack=self, )
class CampaignStatisticsEvents(Entity): '''Represents the `CampaignStatisticsEvents` entity in Pelion Device Management''' def __init__( self, _client=None, campaign_id=None, count=None, created_at=None, description=None, event_type=None, id=None, summary_status=None, summary_status_id=None, ): '''Creates a local `CampaignStatisticsEvents` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param description: :type description: str :param event_type: :type event_type: str :param id: (Required) :type id: str :param summary_status: :type summary_status: str :param summary_status_id: (Required) :type summary_status_id: str ''' pass @property def campaign_id(self): '''ID of the associated campaign. This field must be set when creating a new CampaignStatisticsEvents Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @campaign_id.setter def campaign_id(self): '''Set value of `campaign_id` :param value: value to set :type value: str ''' pass @property def count(self): ''' api example: 10 :rtype: int ''' pass @property def created_at(self): ''' api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def description(self): ''' api example: 'Update error, nonspecific network error' :rtype: str ''' pass @property def event_type(self): ''' api example: 'UPD4_FAIL_101' :rtype: str ''' pass @property def id(self): ''' This field must be set when updating or deleting an existing CampaignStatisticsEvents Entity. api example: 'upd_fail_101' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def summary_status(self): ''' api example: 'FAIL' :rtype: str ''' pass @property def summary_status_id(self): ''' This field must be set when creating a new CampaignStatisticsEvents Entity. api example: 'fail' :rtype: str ''' pass @summary_status_id.setter def summary_status_id(self): '''Set value of `summary_status_id` :param value: value to set :type value: str ''' pass def read(self): '''Get an event type for a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/{event_type_id}>`_. :rtype: CampaignStatisticsEvents ''' pass
25
14
13
3
4
6
1
1.01
1
4
3
0
13
8
13
24
220
59
80
48
44
81
39
26
25
1
2
0
13
2,351
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/campaign_statistics.py
mbed_cloud.foundation.entities.device_update.campaign_statistics.CampaignStatistics
class CampaignStatistics(Entity): """Represents the `CampaignStatistics` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = ["campaign_id", "count", "created_at", "id", "summary_status"] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {} def __init__(self, _client=None, campaign_id=None, count=None, created_at=None, id=None, summary_status=None): """Creates a local `CampaignStatistics` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param id: (Required) ID of the event type description :type id: str :param summary_status: The event type description. :type summary_status: str """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._campaign_id = fields.StringField(value=campaign_id) self._count = fields.IntegerField(value=count) self._created_at = fields.DateTimeField(value=created_at) self._id = fields.StringField(value=id, enum=enums.CampaignStatisticsIdEnum) self._summary_status = fields.StringField(value=summary_status, enum=enums.CampaignStatisticsSummaryStatusEnum) @property def campaign_id(self): """ID of the associated campaign. This field must be set when creating a new CampaignStatistics Entity. api example: '00000000000000000000000000000000' :rtype: str """ return self._campaign_id.value @campaign_id.setter def campaign_id(self, value): """Set value of `campaign_id` :param value: value to set :type value: str """ self._campaign_id.set(value) @property def count(self): """ api example: 10 :rtype: int """ return self._count.value @property def created_at(self): """ api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def id(self): """ID of the event type description This field must be set when updating or deleting an existing CampaignStatistics Entity. api example: 'fail' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def summary_status(self): """The event type description. api example: 'FAIL' :rtype: str """ return self._summary_status.value def events(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get a list of events grouped by summary `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, ASC or DESC. Default value is ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return for each page. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignStatisticsEvents) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CampaignStatisticsEvents from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CampaignStatisticsEvents._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CampaignStatisticsEvents._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CampaignStatisticsEvents, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_events, ) def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): """Get a list of statistics for a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, ASC or DESC. Default value is ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return for each page. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignStatistics) """ from mbed_cloud.foundation._custom_methods import paginate from mbed_cloud.foundation import CampaignStatistics from mbed_cloud import ApiFilter # Be permissive and accept an instance of a dictionary as this was how the Legacy interface worked. if isinstance(filter, dict): filter = ApiFilter(filter_definition=filter, field_renames=CampaignStatistics._renames_to_api) # The preferred method is an ApiFilter instance as this should be easier to use. elif isinstance(filter, ApiFilter): # If filter renames have not be defined then configure the ApiFilter so that any renames # performed by the SDK are reversed when the query parameters are created. if filter.field_renames is None: filter.field_renames = CampaignStatistics._renames_to_api elif filter is not None: raise TypeError("The 'filter' parameter may be either 'dict' or 'ApiFilter'.") return paginate( self=self, foreign_key=CampaignStatistics, filter=filter, order=order, max_results=max_results, page_size=page_size, include=include, wraps=self._paginate_list, ) def _paginate_events(self, after=None, filter=None, order=None, limit=None, include=None): """Get a list of events grouped by summary :param after: Not supported by the API. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Not supported by the API. :type order: str :param limit: Not supported by the API. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/", content_type="application/json", path_params={"campaign_id": self._campaign_id.to_api(), "summary_status_id": self._id.to_api()}, unpack=False, ) def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): """Get a list of statistics for a campaign :param after: Not supported by the API. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Not supported by the API. :type order: str :param limit: Not supported by the API. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse """ # Filter query parameters query_params = filter.to_api() if filter else {} # Add in other query parameters return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/statistics/", content_type="application/json", path_params={"campaign_id": self._campaign_id.to_api()}, unpack=False, ) def read(self): """Get a summary status `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}>`_. :rtype: CampaignStatistics """ return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}", content_type="application/json", path_params={"campaign_id": self._campaign_id.to_api(), "summary_status_id": self._id.to_api()}, unpack=self, )
class CampaignStatistics(Entity): '''Represents the `CampaignStatistics` entity in Pelion Device Management''' def __init__(self, _client=None, campaign_id=None, count=None, created_at=None, id=None, summary_status=None): '''Creates a local `CampaignStatistics` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) ID of the associated campaign. :type campaign_id: str :param count: :type count: int :param created_at: :type created_at: datetime :param id: (Required) ID of the event type description :type id: str :param summary_status: The event type description. :type summary_status: str ''' pass @property def campaign_id(self): '''ID of the associated campaign. This field must be set when creating a new CampaignStatistics Entity. api example: '00000000000000000000000000000000' :rtype: str ''' pass @campaign_id.setter def campaign_id(self): '''Set value of `campaign_id` :param value: value to set :type value: str ''' pass @property def count(self): ''' api example: 10 :rtype: int ''' pass @property def created_at(self): ''' api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def id(self): '''ID of the event type description This field must be set when updating or deleting an existing CampaignStatistics Entity. api example: 'fail' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def summary_status(self): '''The event type description. api example: 'FAIL' :rtype: str ''' pass def events(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Get a list of events grouped by summary `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}/event_types/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, ASC or DESC. Default value is ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return for each page. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignStatisticsEvents) ''' pass def list(self, filter=None, order=None, max_results=None, page_size=None, include=None): '''Get a list of statistics for a campaign `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/>`_. :param filter: Filtering when listing entities is not supported by the API for this entity. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: The order of the records based on creation time, ASC or DESC. Default value is ASC :type order: str :param max_results: Total maximum number of results to retrieve :type max_results: int :param page_size: The number of results to return for each page. :type page_size: int :param include: Comma separated additional data to return. :type include: str :return: An iterator object which yields instances of an entity. :rtype: mbed_cloud.pagination.PaginatedResponse(CampaignStatistics) ''' pass def _paginate_events(self, after=None, filter=None, order=None, limit=None, include=None): '''Get a list of events grouped by summary :param after: Not supported by the API. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Not supported by the API. :type order: str :param limit: Not supported by the API. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def _paginate_list(self, after=None, filter=None, order=None, limit=None, include=None): '''Get a list of statistics for a campaign :param after: Not supported by the API. :type after: str :param filter: Optional API filter for listing resources. :type filter: mbed_cloud.client.api_filter.ApiFilter :param order: Not supported by the API. :type order: str :param limit: Not supported by the API. :type limit: int :param include: Not supported by the API. :type include: str :rtype: mbed_cloud.pagination.PaginatedResponse ''' pass def read(self): '''Get a summary status `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/statistics/{summary_status_id}>`_. :rtype: CampaignStatistics ''' pass
21
14
22
5
7
10
2
1.29
1
10
7
0
13
5
13
24
314
83
101
38
74
130
54
31
34
5
2
2
23
2,352
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/foundation/entities/device_update/campaign_device_metadata.py
mbed_cloud.foundation.entities.device_update.campaign_device_metadata.CampaignDeviceMetadata
class CampaignDeviceMetadata(Entity): """Represents the `CampaignDeviceMetadata` entity in Pelion Device Management""" # List of fields that are serialised between the API and SDK _api_fieldnames = [ "campaign_id", "created_at", "deployment_state", "description", "device_id", "id", "mechanism", "mechanism_url", "name", "updated_at", ] # List of fields that are available for the user of the SDK _sdk_fieldnames = _api_fieldnames # Renames to be performed by the SDK when receiving data {<API Field Name>: <SDK Field Name>} _renames = {"campaign": "campaign_id"} # Renames to be performed by the SDK when sending data {<SDK Field Name>: <API Field Name>} _renames_to_api = {"campaign_id": "campaign"} def __init__( self, _client=None, campaign_id=None, created_at=None, deployment_state=None, description=None, device_id=None, id=None, mechanism=None, mechanism_url=None, name=None, updated_at=None, ): """Creates a local `CampaignDeviceMetadata` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) The device's campaign ID :type campaign_id: str :param created_at: The time the campaign was created :type created_at: datetime :param deployment_state: The state of the update campaign on the device :type deployment_state: str :param description: Description :type description: str :param device_id: The device ID :type device_id: str :param id: (Required) The metadata record ID :type id: str :param mechanism: How the firmware is delivered (connector or direct) :type mechanism: str :param mechanism_url: The Device Management Connect URL :type mechanism_url: str :param name: The record name :type name: str :param updated_at: The record was modified in the database format: date-time :type updated_at: datetime """ super().__init__(_client=_client) # inline imports for avoiding circular references and bulk imports # fields self._campaign_id = fields.StringField(value=campaign_id) self._created_at = fields.DateTimeField(value=created_at) self._deployment_state = fields.StringField( value=deployment_state, enum=enums.CampaignDeviceMetadataDeploymentStateEnum ) self._description = fields.StringField(value=description) self._device_id = fields.StringField(value=device_id) self._id = fields.StringField(value=id) self._mechanism = fields.StringField(value=mechanism) self._mechanism_url = fields.StringField(value=mechanism_url) self._name = fields.StringField(value=name) self._updated_at = fields.DateTimeField(value=updated_at) @property def campaign_id(self): """The device's campaign ID This field must be set when creating a new CampaignDeviceMetadata Entity. api example: '015bf72fccda00000000000100100280' :rtype: str """ return self._campaign_id.value @campaign_id.setter def campaign_id(self, value): """Set value of `campaign_id` :param value: value to set :type value: str """ self._campaign_id.set(value) @property def created_at(self): """The time the campaign was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime """ return self._created_at.value @property def deployment_state(self): """The state of the update campaign on the device :rtype: str """ return self._deployment_state.value @property def description(self): """Description :rtype: str """ return self._description.value @property def device_id(self): """The device ID api example: '015c2fec9bba0000000000010010036f' :rtype: str """ return self._device_id.value @property def id(self): """The metadata record ID This field must be set when updating or deleting an existing CampaignDeviceMetadata Entity. api example: '015c3029f6f7000000000001001000c3' :rtype: str """ return self._id.value @id.setter def id(self, value): """Set value of `id` :param value: value to set :type value: str """ self._id.set(value) @property def mechanism(self): """How the firmware is delivered (connector or direct) api example: 'connector' :rtype: str """ return self._mechanism.value @property def mechanism_url(self): """The Device Management Connect URL :rtype: str """ return self._mechanism_url.value @property def name(self): """The record name api example: 'default_object_name' :rtype: str """ return self._name.value @property def updated_at(self): """The record was modified in the database format: date-time api example: '2017-05-22T12:37:58.776736Z' :rtype: datetime """ return self._updated_at.value def read(self): """Get a campaign device metadata `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/campaign-device-metadata/{campaign_device_metadata_id}/>`_. :rtype: CampaignDeviceMetadata """ return self._client.call_api( method="get", path="/v3/update-campaigns/{campaign_id}/campaign-device-metadata/{campaign_device_metadata_id}/", content_type="application/json", path_params={"campaign_id": self._campaign_id.to_api(), "campaign_device_metadata_id": self._id.to_api()}, unpack=self, )
class CampaignDeviceMetadata(Entity): '''Represents the `CampaignDeviceMetadata` entity in Pelion Device Management''' def __init__( self, _client=None, campaign_id=None, created_at=None, deployment_state=None, description=None, device_id=None, id=None, mechanism=None, mechanism_url=None, name=None, updated_at=None, ): '''Creates a local `CampaignDeviceMetadata` instance Parameters can be supplied on creation of the instance or given by setting the properties on the instance after creation. Parameters marked as `required` must be set for one or more operations on the entity. For details on when they are required please see the documentation for the setter method. :param campaign_id: (Required) The device's campaign ID :type campaign_id: str :param created_at: The time the campaign was created :type created_at: datetime :param deployment_state: The state of the update campaign on the device :type deployment_state: str :param description: Description :type description: str :param device_id: The device ID :type device_id: str :param id: (Required) The metadata record ID :type id: str :param mechanism: How the firmware is delivered (connector or direct) :type mechanism: str :param mechanism_url: The Device Management Connect URL :type mechanism_url: str :param name: The record name :type name: str :param updated_at: The record was modified in the database format: date-time :type updated_at: datetime ''' pass @property def campaign_id(self): '''The device's campaign ID This field must be set when creating a new CampaignDeviceMetadata Entity. api example: '015bf72fccda00000000000100100280' :rtype: str ''' pass @campaign_id.setter def campaign_id(self): '''Set value of `campaign_id` :param value: value to set :type value: str ''' pass @property def created_at(self): '''The time the campaign was created api example: '2017-05-22T12:37:55.576563Z' :rtype: datetime ''' pass @property def deployment_state(self): '''The state of the update campaign on the device :rtype: str ''' pass @property def description(self): '''Description :rtype: str ''' pass @property def device_id(self): '''The device ID api example: '015c2fec9bba0000000000010010036f' :rtype: str ''' pass @property def id(self): '''The metadata record ID This field must be set when updating or deleting an existing CampaignDeviceMetadata Entity. api example: '015c3029f6f7000000000001001000c3' :rtype: str ''' pass @id.setter def id(self): '''Set value of `id` :param value: value to set :type value: str ''' pass @property def mechanism(self): '''How the firmware is delivered (connector or direct) api example: 'connector' :rtype: str ''' pass @property def mechanism_url(self): '''The Device Management Connect URL :rtype: str ''' pass @property def name(self): '''The record name api example: 'default_object_name' :rtype: str ''' pass @property def updated_at(self): '''The record was modified in the database format: date-time api example: '2017-05-22T12:37:58.776736Z' :rtype: datetime ''' pass def read(self): '''Get a campaign device metadata `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/update-campaigns/{campaign_id}/campaign-device-metadata/{campaign_device_metadata_id}/>`_. :rtype: CampaignDeviceMetadata ''' pass
27
15
13
3
4
6
1
0.98
1
4
3
0
14
10
14
25
232
60
87
54
47
85
43
29
28
1
2
0
14
2,353
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_resource_value_channel.py
tests.unit.asynchronous.test_resource_value_channel.FakeConnectAPI
class FakeConnectAPI(object): def list_connected_devices(self): return [FakeDevice("Device1"), FakeDevice("Device2"), FakeDevice("Device3"), FakeDevice("Excluded")] def list_resources(self, unused): return [FakeResource(False, '/3/0/13'), FakeResource(True, '/3/0/21'), FakeResource(False, '/3/0/18'), FakeResource(True, '/3/0/17'), FakeResource(True, '/3/0/2'), FakeResource(False, '/3/0/1'), FakeResource(False, '/3/0/0'), FakeResource(False, '/35011'), FakeResource(True, '/35011/0'), FakeResource(True, '/35011/0/27002'), FakeResource(False, '/10252/0/9'), FakeResource(True, '/10252/0/5'), FakeResource(False, '/10252/0/3'), FakeResource(True, '/10252/0/2'), FakeResource(False, '/10252/0/1')]
class FakeConnectAPI(object): def list_connected_devices(self): pass def list_resources(self, unused): pass
3
0
9
0
9
0
1
0
1
2
2
0
2
0
2
2
21
2
19
3
16
0
5
3
2
1
1
0
2
2,354
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_resource_value_channel.py
tests.unit.asynchronous.test_resource_value_channel.FakeDevice
class FakeDevice(object): def __init__(self, device_id): self.id = device_id
class FakeDevice(object): def __init__(self, device_id): pass
2
0
2
0
2
0
1
0
1
0
0
0
1
1
1
1
3
0
3
3
1
0
3
3
1
1
1
0
1
2,355
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/unit/asynchronous/test_async.py
tests.unit.asynchronous.test_async.Test3BlockingAwait
class Test3BlockingAwait(Test3): # use a Python3 event loop, but a blocking function underneath def setUp(self): super().setUp() import asyncio from tests.unit.asynchronous.blocking_call import slow self.target = slow self.loop = asyncio.get_event_loop() self.AsyncWrapper = AsyncWrapper(concurrency_provider=self.loop, func=self.target)
class Test3BlockingAwait(Test3): def setUp(self): pass
2
0
7
0
7
0
1
0.13
1
1
0
0
1
3
1
81
9
0
8
7
4
1
8
7
4
1
5
0
1
2,356
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/observer.py
mbed_cloud.subscribe.observer.NoMoreNotifications
class NoMoreNotifications(Exception): """Raised as a sentinel when a stream is terminated""" pass
class NoMoreNotifications(Exception): '''Raised as a sentinel when a stream is terminated''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
10
4
1
2
1
1
1
2
1
1
0
3
0
0
2,357
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_security.py
tests.integration.foundation.test_security.TestServerCredentials
class TestServerCredentials(BaseCase): """Test server credentials in lieu of proper tests.""" def check_server_credentials(self, server_credentials): self.assertIn("BEGIN CERTIFICATE", server_credentials.server_certificate) self.assertIn("END CERTIFICATE", server_credentials.server_certificate) def test_get_bootstrap(self): self.check_server_credentials(ServerCredentials().get_bootstrap()) def test_get_lwm2m(self): self.check_server_credentials(ServerCredentials().get_lwm2m())
class TestServerCredentials(BaseCase): '''Test server credentials in lieu of proper tests.''' def check_server_credentials(self, server_credentials): pass def test_get_bootstrap(self): pass def test_get_lwm2m(self): pass
4
1
2
0
2
0
1
0.13
1
1
1
0
3
0
3
75
12
3
8
4
4
1
8
4
4
1
3
0
3
2,358
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_security.py
tests.integration.foundation.test_security.TestCertificateIssuer
class TestCertificateIssuer(BaseCase, CrudMixinTests): """Test certificate issuer in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = CertificateIssuer super(TestCertificateIssuer, cls).setUpClass()
class TestCertificateIssuer(BaseCase, CrudMixinTests): '''Test certificate issuer in lieu of proper tests.''' @classmethod def setUpClass(cls): pass
3
1
3
0
3
0
1
0.2
2
2
1
0
0
0
1
75
7
1
5
3
2
1
4
2
2
1
3
0
1
2,359
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/subscribe.py
mbed_cloud.subscribe.subscribe.RoutingBase
class RoutingBase(object): """Routes unique inbound keys to matching lists of items """ def __init__(self): """Routes""" self._routes = {} def get_route_items(self, route): """Get items attached to this route""" return list(self._routes.get(route, [])) def create_route(self, item, routes): """Stores a new item in routing map""" for route in routes: self._routes.setdefault(route, set()).add(item) return item def remove_routes(self, item, routes): """Removes item from matching routes""" for route in routes: items = self._routes.get(route) try: items.remove(item) LOG.debug('removed item from route %s', route) except ValueError: pass if not items: self._routes.pop(route) LOG.debug('removed route %s', route) def list_all(self): """All items""" return list(set( item for items in self._routes.values() for item in items ))
class RoutingBase(object): '''Routes unique inbound keys to matching lists of items ''' def __init__(self): '''Routes''' pass def get_route_items(self, route): '''Get items attached to this route''' pass def create_route(self, item, routes): '''Stores a new item in routing map''' pass def remove_routes(self, item, routes): '''Removes item from matching routes''' pass def list_all(self): '''All items''' pass
6
6
6
0
5
1
2
0.33
1
3
0
1
5
1
5
5
38
6
24
11
18
8
22
10
16
4
1
2
9
2,360
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/subscribe/subscribe.py
mbed_cloud.subscribe.subscribe.SubscriptionsManager
class SubscriptionsManager(RoutingBase): """Tracks pub/sub state We have four channels for device state One channel for resource subscriptions/presubscriptions One for getting current resource value Some channels map to one logical channel - e.g. four device state channels Some channels are further filtered locally before notifying Observers This system should abstract the mapping between available API channels and observers that expose awaitables/futures/callbacks to the end application """ def __init__(self, connect_api): """Subscriptions Manager""" beta_warning(self.__class__) super(SubscriptionsManager, self).__init__() self.watch_keys = set() self.connect_api = connect_api @property def channels(self): """Shorthand for available channel classes""" # TODO(useability review. Other patterns/best practises) # should the channels be instantiated directly on the Manager already? from mbed_cloud.subscribe import channels return channels def get_channel(self, subscription_channel, **observer_params): """Get or start the requested channel""" keys = subscription_channel.get_routing_keys() # watch keys are unique sets of keys that we will attempt to extract from inbound items self.watch_keys.add(frozenset({k_v[0] for key in keys for k_v in key})) self.create_route(subscription_channel, keys) subscription_channel._configure(self, self.connect_api, observer_params) return subscription_channel def subscribe(self, subscription_channel, **observer_params): """Subscribe to a channel This adds a channel to the router, configures it, starts it, and returns its observer """ return self.get_channel(subscription_channel, **observer_params).ensure_started().observer __call__ = subscribe def _notify_single_item(self, item): """Route inbound items to individual channels""" # channels that this individual item has already triggered # (dont want to trigger them again) triggered_channels = set() for key_set in self.watch_keys: # only pluck keys if they exist plucked = { key_name: item[key_name] for key_name in key_set if key_name in item } route_keys = expand_dict_as_keys(plucked) for route in route_keys: channels = self.get_route_items(route) or {} LOG.debug('route table match: %s -> %s', route, channels) if not channels: LOG.debug( 'no subscribers for message.\nkey %s\nroutes: %s', route, self._routes ) for channel in channels: if channel in triggered_channels: LOG.debug('skipping dispatch to %s', channel) continue LOG.debug('routing dispatch to %s: %s', channel, item) try: channel.notify(item) and triggered_channels.add(channel) except Exception: # noqa LOG.exception('Channel notification failed') return triggered_channels def notify(self, data): """Notify subscribers that data was received""" triggered_channels = [] for channel_name, items in data.items(): for item in items or []: LOG.debug('notify received: %s', item) try: # some channels return strings rather than objects (e.g. de-registrations), # normalize them here item = {'value': item} if isinstance(item, six.string_types) else dict(item) # inject the channel name to the data (so channels can filter on it) item['channel'] = channel_name triggered_channels.extend(list(self._notify_single_item(item))) except Exception: # noqa LOG.exception('Subscription notification failed') return triggered_channels def unsubscribe_all(self): """Unsubscribes all channels""" for channel in self.list_all(): channel.ensure_stopped() self.connect_api.stop_notifications()
class SubscriptionsManager(RoutingBase): '''Tracks pub/sub state We have four channels for device state One channel for resource subscriptions/presubscriptions One for getting current resource value Some channels map to one logical channel - e.g. four device state channels Some channels are further filtered locally before notifying Observers This system should abstract the mapping between available API channels and observers that expose awaitables/futures/callbacks to the end application ''' def __init__(self, connect_api): '''Subscriptions Manager''' pass @property def channels(self): '''Shorthand for available channel classes''' pass def get_channel(self, subscription_channel, **observer_params): '''Get or start the requested channel''' pass def subscribe(self, subscription_channel, **observer_params): '''Subscribe to a channel This adds a channel to the router, configures it, starts it, and returns its observer ''' pass def _notify_single_item(self, item): '''Route inbound items to individual channels''' pass def notify(self, data): '''Notify subscribers that data was received''' pass def unsubscribe_all(self): '''Unsubscribes all channels''' pass
9
8
11
0
8
3
3
0.48
1
6
0
0
7
2
7
12
103
13
62
26
52
30
54
24
45
7
2
4
18
2,361
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/tlv/decode.py
mbed_cloud.tlv.decode.LengthTypes
class LengthTypes(object): """TLV length flags""" ONE_BYTE = 0b00001000 # Length is 8-bits TWO_BYTE = 0b00010000 # Length is 16-bits THR_BYTE = 0b00011000 # Length is 24-bits SET_BYTE = 0b00000000 # Length is specified in bits 2-0 to_ints = { ONE_BYTE: 1, TWO_BYTE: 2, THR_BYTE: 3, }
class LengthTypes(object): '''TLV length flags''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
0
13
2
10
6
9
5
6
6
5
0
1
0
0
2,362
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/tlv/decode.py
mbed_cloud.tlv.decode.Types
class Types(object): """TLV object type flags""" OBJECT = 0b00000000 # Object Instance with one or more TLVs RESOURCE = 0b01000000 # Resource Instance with Value in multi Resource TLV MULTI = 0b10000000 # Multiple Resource, Value contains one or more Resource Instance VALUE = 0b11000000
class Types(object): '''TLV object type flags''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
7
1
5
5
4
5
5
5
4
0
1
0
0
2,363
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/update/update.py
mbed_cloud.update.update.Campaign
class Campaign(BaseObject): """Describes update campaign object.""" @staticmethod def _get_attributes_map(): return { "created_at": "created_at", "description": "description", "device_filter": "device_filter", "finished_at": "finished", "id": "id", "manifest_id": "root_manifest_id", "manifest_url": "root_manifest_url", "name": "name", "phase": "phase", "scheduled_at": "when", "started_at": "started_at", "state": "state", "updated_at": "updated_at", } def _create_patch_request(self): patch_map = { "description": "description", "device_filter": "device_filter", "manifest_id": "root_manifest_id", "name": "name", "scheduled_at": "when", "state": "state", } map_patch = {} for key, value in iteritems(patch_map): val = getattr(self, key, None) if val is not None: map_patch[value] = val return map_patch @property def phase(self): """The phase of this Campaign. :return: The phase of this Campaign. :rtype: str """ return self._phase @property def device_filter(self): """The device filter to use. :rtype: dict """ if isinstance(self._device_filter, str): return self._decode_query(self._device_filter) return self._device_filter @device_filter.setter def device_filter(self, device_filter): """The device filter of this campaign. The filter for the devices the campaign will target :param device_filter: The device filter of this campaign. :type: dict """ self._device_filter = device_filter @property def created_at(self): """The time the object was created (readonly). :rtype: datetime """ return self._created_at @property def updated_at(self): """The time the object was last updated (readonly). :rtype: datetime """ return self._updated_at @property def description(self): """The description of the campaign. :rtype: str """ return self._description @description.setter def description(self, description): """The description of this Campaign. An description of the campaign :param description: The description of this Campaign. :type: str """ self._description = description @property def finished_at(self): """The timestamp when the update campaign finished (readonly). :rtype: datetime """ return self._finished_at @property def id(self): """The ID of the campaign (readonly). :rtype: str """ return self._id @property def manifest_id(self): """The ID of the manifest to use for update. :rtype: str """ return self._manifest_id @manifest_id.setter def manifest_id(self, manifest_id): """The manifest id of this Update Campaign. :param manifest_id: The ID of manifest. :type: str """ self._manifest_id = manifest_id @property def manifest_url(self): """The URL of the manifest used (readonly). :rtype: str """ return self._manifest_url @property def name(self): """The name for this campaign. :rtype: str """ return self._name @name.setter def name(self, name): """The name of this campaign. A name for this campaign :param name: The name of this campaign. :type: str """ if name is not None and len(name) > 128: raise ValueError("Invalid value for `name`, length must be less than or equal to `128`") self._name = name @property def started_at(self): """The timestamp at which update campaign is scheduled to start (readonly). :rtype: datetime """ return self._started_at @property def state(self): """The state of the campaign (readonly). values: draft, scheduled, devicefetch, devicecopy, devicecopycomplete, publishing, deploying, deployed, manifestremoved, expired :rtype: str """ return self._state @property def scheduled_at(self): """The time the object was created. :rtype: datetime """ return self._scheduled_at @scheduled_at.setter def scheduled_at(self, scheduled_at): """The timestamp at which update campaign is scheduled to start. :param scheduled_at: The timestamp of this Cmapaign. :type: str """ self._scheduled_at = scheduled_at
class Campaign(BaseObject): '''Describes update campaign object.''' @staticmethod def _get_attributes_map(): pass def _create_patch_request(self): pass @property def phase(self): '''The phase of this Campaign. :return: The phase of this Campaign. :rtype: str ''' pass @property def device_filter(self): '''The device filter to use. :rtype: dict ''' pass @device_filter.setter def device_filter(self): '''The device filter of this campaign. The filter for the devices the campaign will target :param device_filter: The device filter of this campaign. :type: dict ''' pass @property def created_at(self): '''The time the object was created (readonly). :rtype: datetime ''' pass @property def updated_at(self): '''The time the object was last updated (readonly). :rtype: datetime ''' pass @property def description(self): '''The description of the campaign. :rtype: str ''' pass @description.setter def description(self): '''The description of this Campaign. An description of the campaign :param description: The description of this Campaign. :type: str ''' pass @property def finished_at(self): '''The timestamp when the update campaign finished (readonly). :rtype: datetime ''' pass @property def id(self): '''The ID of the campaign (readonly). :rtype: str ''' pass @property def manifest_id(self): '''The ID of the manifest to use for update. :rtype: str ''' pass @manifest_id.setter def manifest_id(self): '''The manifest id of this Update Campaign. :param manifest_id: The ID of manifest. :type: str ''' pass @property def manifest_url(self): '''The URL of the manifest used (readonly). :rtype: str ''' pass @property def name(self): '''The name for this campaign. :rtype: str ''' pass @name.setter def name(self): '''The name of this campaign. A name for this campaign :param name: The name of this campaign. :type: str ''' pass @property def started_at(self): '''The timestamp at which update campaign is scheduled to start (readonly). :rtype: datetime ''' pass @property def state(self): '''The state of the campaign (readonly). values: draft, scheduled, devicefetch, devicecopy, devicecopycomplete, publishing, deploying, deployed, manifestremoved, expired :rtype: str ''' pass @property def scheduled_at(self): '''The time the object was created. :rtype: datetime ''' pass @scheduled_at.setter def scheduled_at(self): '''The timestamp at which update campaign is scheduled to start. :param scheduled_at: The timestamp of this Cmapaign. :type: str ''' pass
40
19
8
1
4
3
1
0.73
1
2
0
0
19
5
20
28
200
43
91
49
51
66
51
30
30
3
2
2
24
2,364
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/update/update.py
mbed_cloud.update.update.CampaignDeviceState
class CampaignDeviceState(BaseObject): """Describes update campaign device state.""" @staticmethod def _get_attributes_map(): return { "id": "id", "device_id": "device_id", "campaign_id": "campaign", "state": "deployment_state", "name": "name", "description": "description", "created_at": "created_at", "updated_at": "updated_at", "mechanism": "mechanism", "mechanism_url": "mechanism_url" } @property def id(self): """The id of the metadata record (readonly). :rtype: str """ return self._id @property def device_id(self): """The id of the device (readonly). :rtype: str """ return self._device_id @property def campaign_id(self): """The id of the campaign the device is in (readonly). :rtype: str """ return self._campaign_id @property def state(self): """The state of the update campaign on the device (readonly). values: pending, updated_connector_channel, failed_connector_channel_update, deployed, manifestremoved, deregistered :rtype: str """ return self._state @property def name(self): """The name of the device (readonly). :rtype: str """ return self._name @property def description(self): """Description of the device (readonly). :rtype: str """ return self._description @property def created_at(self): """This time the record was created in the database (readonly). :rtype: datetime """ return self._created_at @property def updated_at(self): """This time this record was modified in the database (readonly). :rtype: datetime """ return self._updated_at @property def mechanism(self): """The mechanism used to deliver the firmware (connector or direct) (readonly). :rtype: str """ return self._mechanism @property def mechanism_url(self): """The url of cloud connect used (readonly). :rtype: str """ return self._mechanism_url
class CampaignDeviceState(BaseObject): '''Describes update campaign device state.''' @staticmethod def _get_attributes_map(): pass @property def id(self): '''The id of the metadata record (readonly). :rtype: str ''' pass @property def device_id(self): '''The id of the device (readonly). :rtype: str ''' pass @property def campaign_id(self): '''The id of the campaign the device is in (readonly). :rtype: str ''' pass @property def state(self): '''The state of the update campaign on the device (readonly). values: pending, updated_connector_channel, failed_connector_channel_update, deployed, manifestremoved, deregistered :rtype: str ''' pass @property def name(self): '''The name of the device (readonly). :rtype: str ''' pass @property def description(self): '''Description of the device (readonly). :rtype: str ''' pass @property def created_at(self): '''This time the record was created in the database (readonly). :rtype: datetime ''' pass @property def updated_at(self): '''This time this record was modified in the database (readonly). :rtype: datetime ''' pass @property def mechanism(self): '''The mechanism used to deliver the firmware (connector or direct) (readonly). :rtype: str ''' pass @property def mechanism_url(self): '''The url of cloud connect used (readonly). :rtype: str ''' pass
23
11
7
1
3
3
1
0.73
1
0
0
0
10
0
11
19
100
22
45
23
22
33
23
12
11
1
2
0
11
2,365
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/update/update.py
mbed_cloud.update.update.FirmwareImage
class FirmwareImage(BaseObject): """Describes firmware object.""" @staticmethod def _get_attributes_map(): return { "created_at": "created_at", "datafile_checksum": "datafile_checksum", "datafile_size": "datafile_size", "description": "description", "id": "id", "name": "name", "updated_at": "updated_at", "url": "datafile", } @property def created_at(self): """The time the object was created (readonly). :rtype: datetime """ return self._created_at @property def url(self): """The URL of the firmware image (readonly). :rtype: str """ return self._url @property def datafile_checksum(self): """The checksum generated for the datafile (readonly). :rtype: str """ return self._datafile_checksum @property def datafile_size(self): """Size of the datafile (in bytes) (readonly). :rtype: int """ return self._datafile_size @property def description(self): """Get the description of firmware image (readonly). :rtype: str """ return self._description @property def id(self): """Get the ID of the firmware image (readonly). :rtype: str """ return self._id @property def name(self): """Get the name of firmware image (readonly). :rtype: str """ return self._name @property def updated_at(self): """Get the time the object was updated (readonly). :rtype: datetime """ return self._updated_at
class FirmwareImage(BaseObject): '''Describes firmware object.''' @staticmethod def _get_attributes_map(): pass @property def created_at(self): '''The time the object was created (readonly). :rtype: datetime ''' pass @property def url(self): '''The URL of the firmware image (readonly). :rtype: str ''' pass @property def datafile_checksum(self): '''The checksum generated for the datafile (readonly). :rtype: str ''' pass @property def datafile_size(self): '''Size of the datafile (in bytes) (readonly). :rtype: int ''' pass @property def description(self): '''Get the description of firmware image (readonly). :rtype: str ''' pass @property def id(self): '''Get the ID of the firmware image (readonly). :rtype: str ''' pass @property def name(self): '''Get the name of firmware image (readonly). :rtype: str ''' pass @property def updated_at(self): '''Get the time the object was updated (readonly). :rtype: datetime ''' pass
19
9
7
1
3
3
1
0.68
1
0
0
0
8
0
9
17
79
17
37
19
18
25
19
10
9
1
2
0
9
2,366
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/update/update.py
mbed_cloud.update.update.FirmwareManifest
class FirmwareManifest(BaseObject): """Describes firmware object.""" @staticmethod def _get_attributes_map(): return { "created_at": "created_at", "url": "datafile", "key_table_url": "key_table", "description": "description", "device_class": "device_class", "datafile_size": "datafile_size", "id": "id", "name": "name", "timestamp": "timestamp", "updated_at": "updated_at", "version": "version" } @property def created_at(self): """Get the time the object was created (readonly). :rtype: datetime """ return self._created_at @property def url(self): """Get the URL of the firmware manifest (readonly). :rtype: str """ return self._url @property def key_table_url(self): """The URL of the key_table (readonly). :rtype: str """ return self._key_table_url @property def description(self): """Get the description of firmware manifest (readonly). :rtype: str """ return self._description @property def device_class(self): """The class of device (readonly). :rtype: str """ return self._device_class @property def datafile_size(self): """Size of the datafile (in bytes) (readonly). :rtype: int """ return self._datafile_size @property def id(self): """The ID of the firmware manifest (readonly). :rtype: str """ return self._id @property def name(self): """The name of the firmware manifest (readonly). :rtype: str """ return self._name @property def timestamp(self): """The timestamp of the firmware manifest (readonly). :rtype: datetime """ return self._timestamp @property def updated_at(self): """The time the object was updated (readonly). :rtype: datetime """ return self._updated_at @property def version(self): """The time the object was updated (readonly). :rtype: str """ return self._version
class FirmwareManifest(BaseObject): '''Describes firmware object.''' @staticmethod def _get_attributes_map(): pass @property def created_at(self): '''Get the time the object was created (readonly). :rtype: datetime ''' pass @property def url(self): '''Get the URL of the firmware manifest (readonly). :rtype: str ''' pass @property def key_table_url(self): '''The URL of the key_table (readonly). :rtype: str ''' pass @property def description(self): '''Get the description of firmware manifest (readonly). :rtype: str ''' pass @property def device_class(self): '''The class of device (readonly). :rtype: str ''' pass @property def datafile_size(self): '''Size of the datafile (in bytes) (readonly). :rtype: int ''' pass @property def id(self): '''The ID of the firmware manifest (readonly). :rtype: str ''' pass @property def name(self): '''The name of the firmware manifest (readonly). :rtype: str ''' pass @property def timestamp(self): '''The timestamp of the firmware manifest (readonly). :rtype: datetime ''' pass @property def updated_at(self): '''The time the object was updated (readonly). :rtype: datetime ''' pass @property def version(self): '''The time the object was updated (readonly). :rtype: str ''' pass
25
12
7
1
3
3
1
0.69
1
0
0
0
11
0
12
20
106
23
49
25
24
34
25
13
12
1
2
0
12
2,367
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/scripts/foundation/render_sdk.py
render_sdk.TemplateRenderer
class TemplateRenderer(object): """Foundation Interface Template Renderer for jinja2""" def __init__(self, output_root_dir): """Setup the jinja2 environment :param str output_root_dir: Root directory in which to write the Foundation interface. """ self.output_root_dir = output_root_dir self.jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(TEMPLATE_DIR)) self.jinja_env.filters['repr'] = repr self.jinja_env.filters['pargs_kwargs'] = sort_parg_kwarg self.jinja_env.filters.update(dict( repr=repr, sort_parg_kwarg=sort_parg_kwarg, to_snake=to_snake_case, to_pascal=to_pascal_case, to_singular_name=to_singular_name, )) def render_template(self, template_filename, group="group", entity="entity", template_data=None): """Render one or more jinja2 templates. The output filename is relative to the `output_root_dir` defined in the class instance but is also defined by the `template_filename`. The `template_filename` should be interspersed with `.` to indicate subdirectories. Two place holders are also supported in the template filename: - `group`: which will be replaced by the `group` parameter - `entity`: which will be replaced by the `entity` parameter :param str template_filename: name of template to render, this also defines the output path and filename. :param str group: This should be supplied when the template filename contains `group` . :param str entity: This should be supplied when the template filename contains `entity`. :param dict template_data: Data to pass to the template. """ template = self.jinja_env.get_template(template_filename) # Remove template extension (we'll append .py later). output_path = template_filename.replace(".jinja2", "") # Covert the template filename to a path (which will be relative to the output_root_dir). output_path = output_path.replace(".", os.path.sep) # If `group` or `entity` exist in the path name replace them with the provided group and entity parameters output_path = output_path.replace("group", to_snake_case(group)) output_path = output_path.replace("entity", to_snake_case(entity)) # Combine the root directory with the directory defined by the template filename output_path = os.path.join(self.output_root_dir, output_path) + ".py" output_dir = os.path.dirname(output_path) if not os.path.exists(output_dir): logger.info("Creating subdirectory '%s'", output_dir) os.makedirs(output_dir) logger.info("Rendering template from '%s' to '%s'", template_filename, output_path) rendered = template.render(template_data) with open(output_path, "w") as output_fh: output_fh.write(rendered)
class TemplateRenderer(object): '''Foundation Interface Template Renderer for jinja2''' def __init__(self, output_root_dir): '''Setup the jinja2 environment :param str output_root_dir: Root directory in which to write the Foundation interface. ''' pass def render_template(self, template_filename, group="group", entity="entity", template_data=None): '''Render one or more jinja2 templates. The output filename is relative to the `output_root_dir` defined in the class instance but is also defined by the `template_filename`. The `template_filename` should be interspersed with `.` to indicate subdirectories. Two place holders are also supported in the template filename: - `group`: which will be replaced by the `group` parameter - `entity`: which will be replaced by the `entity` parameter :param str template_filename: name of template to render, this also defines the output path and filename. :param str group: This should be supplied when the template filename contains `group` . :param str entity: This should be supplied when the template filename contains `entity`. :param dict template_data: Data to pass to the template. ''' pass
3
3
28
6
14
9
2
0.68
1
1
0
0
2
2
2
2
60
13
28
10
25
19
22
9
19
2
1
1
3
2,368
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/scripts/generate_ci_config.py
scripts.generate_ci_config.Test
class Test(unittest.TestCase): """Test""" def setUp(self): """Make sure we have some logging running""" logging.basicConfig(level=logging.INFO) def test(self): """Runs build as if it were a test""" main()
class Test(unittest.TestCase): '''Test''' def setUp(self): '''Make sure we have some logging running''' pass def test(self): '''Runs build as if it were a test''' pass
3
3
3
0
2
1
1
0.6
1
0
0
0
2
0
2
74
10
2
5
3
2
3
5
3
2
1
2
0
2
2,369
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/core.py
mbed_cloud.core.ApiMetadata
class ApiMetadata(object): """Api meta data.""" def __init__(self, url, method, response=None, response_data=None, exception=None): """Initialise new api metadata object.""" self._url = url self._method = method self._status_code = 400 self._headers = [] self._request_id = "" self._object = None self._etag = "" self._error_message = "" self._date = datetime.datetime.utcnow() if exception is not None: self._set_exception(exception) self._set_headers(exception) else: self._set_response(response, response_data) self._set_headers(response) def _set_headers(self, obj): if hasattr(obj, 'getheaders'): self._headers = obj.getheaders() self._date = self._headers.get("date", datetime.datetime.utcnow()) self._request_id = self._headers.get("x-request-id", "") elif hasattr(obj, 'headers'): self._headers = getattr(obj, "headers") self._date = self._headers.get("date", datetime.datetime.utcnow()) self._request_id = self._headers.get("x-request-id", "") def _set_exception(self, exception): if hasattr(exception, 'status'): self._status_code = getattr(exception, 'status') if hasattr(exception, 'reason'): self._error_message = getattr(exception, 'reason') else: self._error_message = str(exception) or '' if hasattr(exception, 'body'): self._set_response(getattr(exception, 'body')) def _set_response(self, response=None, response_data=None): if response is not None: if hasattr(response, 'status'): self._status_code = getattr(response, 'status') self._set_headers(response) if response_data is not None: if hasattr(response_data, 'object'): self._object = getattr(response_data, 'object') if hasattr(response_data, 'etag'): self._etag = getattr(response_data, 'etag') @property def url(self): """URL of the API request. :rtype: str """ return self._url @property def method(self): """Method of the API request. :rtype: str """ return self._method @property def status_code(self): """HTTP Status code of the API response. :rtype: int """ return self._status_code @property def date(self): """Date of the API response. :rtype: datetime """ return self._date @property def headers(self): """Headers in the API response. :rtype: list """ return self._headers @property def request_id(self): """Request ID of the transaction. :rtype: str """ return self._request_id @property def object(self): """Object type of the returned data. :rtype: str """ return self._object @property def etag(self): """Etag of the returned data. :rtype: str """ return self._etag @property def error_message(self): """Error message. :rtype: str """ return self._error_message def to_dict(self): """Return dictionary of object.""" dictionary = {} for key, value in iteritems(self.__dict__): property_name = key[1:] if hasattr(self, property_name): dictionary.update({property_name: getattr(self, property_name, None)}) return dictionary def __repr__(self): """For print and pprint.""" return str(self.to_dict())
class ApiMetadata(object): '''Api meta data.''' def __init__(self, url, method, response=None, response_data=None, exception=None): '''Initialise new api metadata object.''' pass def _set_headers(self, obj): pass def _set_exception(self, exception): pass def _set_response(self, response=None, response_data=None): pass @property def url(self): '''URL of the API request. :rtype: str ''' pass @property def method(self): '''Method of the API request. :rtype: str ''' pass @property def status_code(self): '''HTTP Status code of the API response. :rtype: int ''' pass @property def date(self): '''Date of the API response. :rtype: datetime ''' pass @property def headers(self): '''Headers in the API response. :rtype: list ''' pass @property def request_id(self): '''Request ID of the transaction. :rtype: str ''' pass @property def object(self): '''Object type of the returned data. :rtype: str ''' pass @property def etag(self): '''Etag of the returned data. :rtype: str ''' pass @property def error_message(self): '''Error message. :rtype: str ''' pass def to_dict(self): '''Return dictionary of object.''' pass def __repr__(self): '''For print and pprint.''' pass
25
13
7
1
5
2
2
0.38
1
2
0
0
15
9
15
15
136
24
81
37
56
31
69
28
53
6
1
2
28
2,370
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_security.py
tests.integration.foundation.test_security.TestCertificateIssuerConfig
class TestCertificateIssuerConfig(BaseCase, CrudMixinTests): """Test certificate issuer configuration in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = CertificateIssuerConfig super(TestCertificateIssuerConfig, cls).setUpClass()
class TestCertificateIssuerConfig(BaseCase, CrudMixinTests): '''Test certificate issuer configuration in lieu of proper tests.''' @classmethod def setUpClass(cls): pass
3
1
3
0
3
0
1
0.2
2
2
1
0
0
0
1
75
7
1
5
3
2
1
4
2
2
1
3
0
1
2,371
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/common.py
tests.common.CrudMixinTests
class CrudMixinTests(object): """Test definition for generic CRUD operations.""" @classmethod def setUpClass(cls): print("\n** %s **" % cls.class_under_test.__name__) def test_listing(self): count = 0 for entity in self.class_under_test().list(page_size=3, max_results=5): self.assertEqual(self.class_under_test, entity.__class__, "Unexpected class returned from the list method") count += 1 self.assertTrue(count <= 5, "At most 5 entities should be returned due to the max_results parameter")
class CrudMixinTests(object): '''Test definition for generic CRUD operations.''' @classmethod def setUpClass(cls): pass def test_listing(self): pass
4
1
5
1
4
0
2
0.1
1
0
0
12
1
0
2
2
14
3
10
6
6
1
9
5
6
2
1
1
3
2,372
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_accounts.py
tests.integration.foundation.test_accounts.TestAccount
class TestAccount(BaseCase, CrudMixinTests): """Test certificate enrollment in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = Account super(TestAccount, cls).setUpClass() def test_policies(self): for account in Account().list(include="policies"): policies = account.policies self.assertIsInstance(policies, list) for policy in policies: self.assertIsInstance(policy.action, str) self.assertIsInstance(policy.allow, bool) self.assertIsInstance(policy.feature, str) self.assertIsInstance(policy.inherited, bool) def test_password_policy(self): for account in Account().list(): if account.password_policy: self.assertIsInstance(account.password_policy, dict) def check_subtenant_listing(self, listmethod, expected_entity): count = 0 for entity in listmethod(page_size=3, max_results=5): self.assertEqual(expected_entity, entity.__class__, "Unexpected class returned from the list method") count += 1 self.assertTrue(count <= 5, "At most 5 entities should be returned due to the max_results parameter") def test_trusted_certificates(self): my_account = Account().me() self.check_subtenant_listing(my_account.trusted_certificates, SubtenantTrustedCertificate) def test_user_invitations(self): my_account = Account().me() self.check_subtenant_listing(my_account.user_invitations, SubtenantUserInvitation) def test_users(self): my_account = Account().me() self.check_subtenant_listing(my_account.users, SubtenantUser) def test_subtenant_user(self): """Example of creating a user in a subtenant account""" # Keep the example at the same indent level so the documentation looks sensible try: # an example: creating and managing a subtenant account from mbed_cloud.foundation import Account, SubtenantUser # Populate the new account details new_subtenant = Account( display_name='sdk test bob', aliases=['sdk_test_bob_' + random_string()], end_market='connected warrens', # Admin user details admin_full_name='bob the wombat', admin_email='[email protected]', ) # Create the new account new_subtenant.create() # cloak except ApiErrorResponse as api_error: self.assertEqual(api_error.status_code, 403, "The limit of account creation may have been reached") account = None for account in Account().list(): if account.display_name == "sdk_test_bob": break self.assertIsNotNone(account, "Account could not be found") # Fake the creation new_subtenant = account finally: # uncloak account_id = new_subtenant.id print("This is my new Account ID: %s" % account_id) # cloak # Record the number of users to check that creating and deleting works num_users = len(new_subtenant.users()) # uncloak # Populate the new user details new_user = SubtenantUser( # Link this user to the account account_id=account_id, # User details username='JaneDoeSDK', full_name='Jane Doe', email='[email protected]', phone_number='1800966228', ) # Create the new user new_user.create() # end of example self.assertEqual(len(new_subtenant.users()), num_users+1, "There should be one more user") new_user.delete() self.assertEqual(len(new_subtenant.users()), num_users, "The number of users should be back to it's original value")
class TestAccount(BaseCase, CrudMixinTests): '''Test certificate enrollment in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_policies(self): pass def test_password_policy(self): pass def check_subtenant_listing(self, listmethod, expected_entity): pass def test_trusted_certificates(self): pass def test_user_invitations(self): pass def test_users(self): pass def test_subtenant_user(self): '''Example of creating a user in a subtenant account''' pass
10
2
11
1
8
2
2
0.26
2
10
5
0
7
0
8
82
102
16
68
26
57
18
53
24
43
4
3
3
16
2,373
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_accounts.py
tests.integration.foundation.test_accounts.TestApiKey
class TestApiKey(BaseCase, CrudMixinTests): """Test certificate issuer in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = ApiKey super(TestApiKey, cls).setUpClass() def test_me(self): my_apikey = ApiKey().me() self.assertTrue(my_apikey.key.startswith("ak_"))
class TestApiKey(BaseCase, CrudMixinTests): '''Test certificate issuer in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_me(self): pass
4
1
3
0
3
0
1
0.13
2
2
1
0
1
0
2
76
11
2
8
5
4
1
7
4
4
1
3
0
2
2,374
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_accounts.py
tests.integration.foundation.test_accounts.TestUser
class TestUser(BaseCase, CrudMixinTests): """Test certificate issuer configuration in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = User super(TestUser, cls).setUpClass() def test_login_history(self): from datetime import datetime for user in User().list(): if isinstance(user.login_history, list): for login in user.login_history: self.assertIsInstance(login.date, datetime) self.assertIsInstance(login.ip_address, str) self.assertIsInstance(login.success, bool) self.assertIsInstance(login.user_agent, str)
class TestUser(BaseCase, CrudMixinTests): '''Test certificate issuer configuration in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_login_history(self): pass
4
1
6
0
6
0
3
0.07
2
6
1
0
1
0
2
76
17
2
14
7
9
1
13
6
9
4
3
3
5
2,375
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_accounts.py
tests.integration.foundation.test_accounts.TestUserInvitation
class TestUserInvitation(BaseCase, CrudMixinTests): """Test certificates in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = UserInvitation super(TestUserInvitation, cls).setUpClass()
class TestUserInvitation(BaseCase, CrudMixinTests): '''Test certificates in lieu of proper tests.''' @classmethod def setUpClass(cls): pass
3
1
3
0
3
0
1
0.2
2
2
1
0
0
0
1
75
7
1
5
3
2
1
4
2
2
1
3
0
1
2,376
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_devices.py
tests.integration.foundation.test_devices.TestDevice
class TestDevice(BaseCase, CrudMixinTests): """Test devices in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = Device super(TestDevice, cls).setUpClass() def test_cert_renew(self): """Example of renewing a certificate on a device.""" # an example: certificate renew # Find all certificate issuers that may be in use certificate_references = [] for certificate_issuer_config in CertificateIssuerConfig().list(): certificate_references.append(certificate_issuer_config.certificate_reference) # List all devices for device in Device().list(): # A certificate can only be renewed on a registered device if device.state == DeviceStateEnum.REGISTERED: # It is not possible to determine which certificate issuer has been used on a # device so try them in turn. for certificate_reference in certificate_references: try: # If the wrong certificate issuer is selected then the renew will fail device.renew_certificate(certificate_reference) except ApiErrorResponse: print("Certificate '%s' could not be renewed on device '%s'" % ( certificate_reference, device.name)) else: print("Certificate '%s' was renewed on device '%s'" % ( certificate_reference, device.name))
class TestDevice(BaseCase, CrudMixinTests): '''Test devices in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_cert_renew(self): '''Example of renewing a certificate on a device.''' pass
4
2
14
1
9
4
4
0.45
2
5
4
0
1
0
2
76
33
4
20
8
16
9
17
7
14
6
3
4
7
2,377
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_devices.py
tests.integration.foundation.test_devices.TestDeviceEnrollment
class TestDeviceEnrollment(BaseCase, CrudMixinTests): """Test device enrollment in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = DeviceEnrollment super(TestDeviceEnrollment, cls).setUpClass() def test_device_enrollment_single(self): """Example of enrolling a device in Pelion Device Management.""" try: # an example: device enrollment single # Enroll a single device using the enrollment ID for the device device_enrollment = DeviceEnrollment( enrollment_identity = "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12") device_enrollment.create() # end of example except ApiErrorResponse as api_error: self.assertEqual(api_error.status_code, 409, "This should be a duplicate identity") def test_device_enrollment_bulk_create(self): """Example of enrolling a device in Pelion Device Management.""" # an example: device enrollment bulk with open("tests/fixtures/bulk_device_enrollment.csv", "rb") as csv_file_handle: bulk_device_enrollment = DeviceEnrollmentBulkCreate().create(csv_file_handle) while bulk_device_enrollment.status != DeviceEnrollmentBulkCreateStatusEnum.COMPLETED: time.sleep(1) bulk_device_enrollment.get() print(bulk_device_enrollment.download_full_report_file().read()) print(bulk_device_enrollment.download_errors_report_file().read()) # end of example def test_device_enrollment_bulk_delete(self): """Example of enrolling a device in Pelion Device Management.""" with open("tests/fixtures/bulk_device_enrollment.csv", "rb") as csv_file_handle: bulk_device_enrollment = DeviceEnrollmentBulkDelete().delete(csv_file_handle) while bulk_device_enrollment.status != DeviceEnrollmentBulkDeleteStatusEnum.COMPLETED: time.sleep(1) bulk_device_enrollment.get() print(bulk_device_enrollment.download_full_report_file().read()) print(bulk_device_enrollment.download_errors_report_file().read())
class TestDeviceEnrollment(BaseCase, CrudMixinTests): '''Test device enrollment in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_device_enrollment_single(self): '''Example of enrolling a device in Pelion Device Management.''' pass def test_device_enrollment_bulk_create(self): '''Example of enrolling a device in Pelion Device Management.''' pass def test_device_enrollment_bulk_delete(self): '''Example of enrolling a device in Pelion Device Management.''' pass
6
4
10
2
7
2
2
0.32
2
7
6
0
3
0
4
78
47
10
28
12
22
9
26
8
21
2
3
1
7
2,378
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_devices.py
tests.integration.foundation.test_devices.TestDeviceEvents
class TestDeviceEvents(BaseCase, CrudMixinTests): """Test device events in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = DeviceEvents super(TestDeviceEvents, cls).setUpClass()
class TestDeviceEvents(BaseCase, CrudMixinTests): '''Test device events in lieu of proper tests.''' @classmethod def setUpClass(cls): pass
3
1
3
0
3
0
1
0.2
2
2
1
0
0
0
1
75
7
1
5
3
2
1
4
2
2
1
3
0
1
2,379
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_devices.py
tests.integration.foundation.test_devices.TestDeviceGroups
class TestDeviceGroups(BaseCase, CrudMixinTests): """Test device events in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = DeviceGroup super(TestDeviceGroups, cls).setUpClass() def test_filtering(self): for group in DeviceGroup().list(filter={'devices_count': {'nin': [1,2]}}): print(group.to_api())
class TestDeviceGroups(BaseCase, CrudMixinTests): '''Test device events in lieu of proper tests.''' @classmethod def setUpClass(cls): pass def test_filtering(self): pass
4
1
3
0
3
0
2
0.13
2
2
1
0
1
0
2
76
11
2
8
5
4
1
7
4
4
2
3
1
3
2,380
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_examples.py
tests.integration.foundation.test_examples.TestExamples
class TestExamples(BaseCase): def test_hello_world(self): # an example: hello world from mbed_cloud.foundation import Device # List the first 10 devices on your Pelion Device Management account. for device in Device().list(max_results=10): print("Hello device %s" % device.name) # end of example def test_hello_world_with_sdk_instance(self): # an example: hello world with sdk instance from mbed_cloud import SDK # Create an instance of the Pelion Device Management SDK pelion_dm_sdk = SDK() # List the first 10 devices on your Pelion DM account for device in pelion_dm_sdk.foundation.device().list(max_results=10): print("Hello device %s" % device.name) # end of example def test_hello_world_with_multiple_api_keys(self): ACCOUNT_ONE_API_KEY = os.getenv("MBED_CLOUD_SDK_API_KEY") ACCOUNT_TWO_API_KEY = os.getenv("MBED_CLOUD_SDK_API_KEY") # an example: hello world with multiple api keys from mbed_cloud import SDK # Create instances of the Pelion Device Management SDK for two accounts account_one = SDK(api_key=ACCOUNT_ONE_API_KEY) account_two = SDK(api_key=ACCOUNT_TWO_API_KEY) # List the first 10 devices on the first account for device in account_one.foundation.device().list(max_results=10): print("Account One device %s" % device.name) # List the first 10 devices on the second account for device in account_two.foundation.device().list(max_results=10): print("Account Two device %s" % device.name) # end of example def test_crud_of_an_entity(self): """Example of create, read, update and delete of a user""" from mbed_cloud import SDK pelion_dm_sdk = SDK() num_users = len(pelion_dm_sdk.foundation.user().list()) # Keep the example at the same indent level so the documentation looks sensible try: # an example: create an entity new_user = pelion_dm_sdk.foundation.user( email="[email protected]", ) new_user.create() # end of example self.assertEqual(len(User().list()), num_users+1, "The number of users should have increase") user_id = new_user.id # an example: read an entity user_one = pelion_dm_sdk.foundation.user(id=user_id).read() print("User email address: %s" % user_one.email) # end of example # an example: update an entity user_two = pelion_dm_sdk.foundation.user(id=user_id).read() user_two.full_name = "Python SDK User" user_two.update() # end of example self.assertEqual(user_two.read().full_name, "Python SDK User", "User name should have been changed") # an example: delete an entity pelion_dm_sdk.foundation.user(id=user_id).delete() # end of example except Exception: new_user.delete() self.assertEqual(len(User().list()), num_users, "The number of users should be back to it's original value") def test_list_entities(self): from mbed_cloud import SDK pelion_dm_sdk = SDK() # an example: list entities paginator = pelion_dm_sdk.foundation.user().list( order="ASC", page_size=5, max_results=10, include="total_count") for user in paginator: print("%s (%s): %s" % (user.full_name, user.id, user.email)) print("Total Count: %d" % paginator.count()) # end of example def test_read_first_entity_in_list(self): from mbed_cloud import SDK pelion_dm_sdk = SDK() # an example: read first entity in list first_user_in_list = pelion_dm_sdk.foundation.user().list().first() print("User email address: %s" % first_user_in_list.email) # end of example def test_list_entities_with_filters(self): from mbed_cloud import SDK pelion_dm_sdk = SDK() # an example: list entities with filters from mbed_cloud import ApiFilter from mbed_cloud.foundation.enums import UserStatusEnum api_filter = ApiFilter() api_filter.add_filter("email", "eq", "[email protected]") api_filter.add_filter("status", "in", [UserStatusEnum.ACTIVE, UserStatusEnum.ENROLLING]) for user in pelion_dm_sdk.foundation.user().list(filter=api_filter): print("%s (%s): %s" % (user.full_name, user.id, user.email)) # end of example def test_quick(self): # an example: checking account status from mbed_cloud.foundation import Account from mbed_cloud.foundation.enums import AccountStatusEnum my_account = Account() my_account.me() print(my_account.display_name) is_active = my_account.status == AccountStatusEnum.ACTIVE # end of example self.assertTrue(is_active) def test_listing(self): # an example: listing api keys from mbed_cloud.foundation import ApiKey all_keys = ApiKey().list() all_key_names = [key.name for key in all_keys] # end of example self.assertGreaterEqual(len(all_key_names), 1) def test_really_custom_config(self): # an example: using custom hosts from mbed_cloud import SDK from mbed_cloud.sdk import Config config = Config(api_key='ak_1', host='https://example') all_users = SDK(config).foundation.user().list() # end of example self.assertIsInstance(all_users, PaginatedResponse) def test_custom_api_call(self): # an example: custom api call from mbed_cloud import SDK from mbed_cloud.foundation import User response = SDK().client.call_api('get', '/v3/users', query_params={'limit': 2}) # response object from the`requests` library for user_data in response.json()['data']: user = User().from_api(**user_data) # end of example self.assertIsInstance(user, User) self.assertIsNotNone(user.id) def test_certificate_black_listing(self): from mbed_cloud.foundation import TrustedCertificate # Find a production certificate my_certificate = TrustedCertificate().list(filter={"device_execution_mode": {"neq": 1}}).first() my_cert_id = my_certificate.id # Record the original status to revert to its original state at the end original_status = TrustedCertificate(id=my_cert_id).read().status # an example: certificate black listing from mbed_cloud import SDK from mbed_cloud import ApiFilter from mbed_cloud.foundation.enums import TrustedCertificateStatusEnum pelion_dm_sdk = SDK() # Set the certificate to inactive my_cert = pelion_dm_sdk.foundation.trusted_certificate(id=my_cert_id).read() my_cert.status = TrustedCertificateStatusEnum.INACTIVE my_cert.update() # List all devices which have tried to bootstrap api_filter = ApiFilter() api_filter.add_filter("trusted_certificate_id", "eq", my_cert) for device_denial in pelion_dm_sdk.foundation.device_enrollment_denial().list(filter=api_filter): print("Device endpoint name: %s" % device_denial.endpoint_name) # end of example new_status = my_cert.read().status self.assertEqual(TrustedCertificateStatusEnum.INACTIVE, new_status, "Status should have been set to disabled") # Revert the certificate to its original status my_cert.status = original_status my_cert.update() end_status = my_cert.read().status self.assertEqual(original_status, end_status, "Status should have been reverted back to its original value") def test_firmware_update_campaign_launch(self): from mbed_cloud.foundation import FirmwareManifest firmware_manifest = FirmwareManifest().list().first() my_manifest_id = firmware_manifest.id # an example: firmware update campaign launch from datetime import datetime from pprint import pprint from mbed_cloud import SDK from mbed_cloud import ApiFilter pelion_dm_sdk = SDK() new_campaign = pelion_dm_sdk.foundation.update_campaign( root_manifest_id=my_manifest_id, name="campaign - " + str(datetime.now()), description="Update campaign for prior 2019 devices" ) # Create a filter for all devices created before the 1st of January 2019 so that these devices will have their # firmware replaced by the one defined in the manifest. api_filter = ApiFilter() api_filter.add_filter("created_at", "lte", datetime(2019, 1, 1)) new_campaign.device_filter_helper = api_filter # Create the campaign new_campaign.create() # Determine the phase of the campaign print("Campaign Phase:", new_campaign.phase) # Start the campaign new_campaign.start() # Determine the phase of the campaign new_campaign.read() print("Campaign Phase:", new_campaign.phase) # Print all device metadata related to this campaign for campaign_device_metadata in new_campaign.device_metadata(): pprint(campaign_device_metadata.to_dict()) # end of example new_campaign.stop() new_campaign.read() print("Campaign Phase:", new_campaign.phase) new_campaign.delete()
class TestExamples(BaseCase): def test_hello_world(self): pass def test_hello_world_with_sdk_instance(self): pass def test_hello_world_with_multiple_api_keys(self): pass def test_crud_of_an_entity(self): '''Example of create, read, update and delete of a user''' pass def test_list_entities(self): pass def test_read_first_entity_in_list(self): pass def test_list_entities_with_filters(self): pass def test_quick(self): pass def test_listing(self): pass def test_really_custom_config(self): pass def test_custom_api_call(self): pass def test_certificate_black_listing(self): pass def test_firmware_update_campaign_launch(self): pass
14
1
18
3
11
4
2
0.37
1
14
11
0
13
0
13
85
255
58
144
85
105
53
134
85
95
3
3
1
23
2,381
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_field_lookups.py
tests.integration.foundation.test_field_lookups.TestLookups
class TestLookups(BaseCase): """This test should implement something like the following sequence: plain attr -> print / read / set / read / print phone number list of ids - > print first id of group_ids paginated self -> print first full_name of first user list of nested -> print first date of first loginhistory paginated other -> print name of first group """ created = None def new_user(self): return User( username='wombat', full_name='Scratchy The Wombat', email='[email protected]', phone_number='1800966228', ) def tearDown(self): if self.created: User(id=self.created).delete() def test_modify_simple_attributes(self): new_user = self.new_user() self.assertEqual('1800966228', new_user.phone_number) new_user.phone_number = '0800966228' self.assertEqual('0800966228', new_user.phone_number) def test_sequence(self): new_user = self.new_user() try: new_user.create() except ApiErrorResponse as api_error: # If there is an error then it should be a 409 # as at some point the user was not deleted self.assertEqual(api_error.status_code, 409) else: self.created = new_user.id self.assertEqual('1800966228', new_user.phone_number, "User should have been created with the phone number") new_user.phone_number = '999' self.assertEqual('999', new_user.phone_number, "The phone number property should contain the local update") new_user.read() self.assertEqual('1800966228', new_user.phone_number, "After getting the user the local update should be reverted") new_user.phone_number = '0800966228' new_user.update() new_user.read() self.assertEqual('0800966228', new_user.phone_number, "The local update should now be in the replicated in the cloud")
class TestLookups(BaseCase): '''This test should implement something like the following sequence: plain attr -> print / read / set / read / print phone number list of ids - > print first id of group_ids paginated self -> print first full_name of first user list of nested -> print first date of first loginhistory paginated other -> print name of first group ''' def new_user(self): pass def tearDown(self): pass def test_modify_simple_attributes(self): pass def test_sequence(self): pass
5
1
10
1
9
1
2
0.25
1
2
2
0
4
0
4
76
57
12
36
9
31
9
29
8
24
2
3
1
6
2,382
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/foundation/test_security.py
tests.integration.foundation.test_security.TestCertificateEnrollment
class TestCertificateEnrollment(BaseCase, CrudMixinTests): """Test certificate enrollment in lieu of proper tests.""" @classmethod def setUpClass(cls): cls.class_under_test = CertificateEnrollment super(TestCertificateEnrollment, cls).setUpClass()
class TestCertificateEnrollment(BaseCase, CrudMixinTests): '''Test certificate enrollment in lieu of proper tests.''' @classmethod def setUpClass(cls): pass
3
1
3
0
3
0
1
0.2
2
2
1
0
0
0
1
75
7
1
5
3
2
1
4
2
2
1
3
0
1
2,383
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/tests/integration/examples/test_resource_values.py
tests.integration.examples.test_resource_values.TestExamples
class TestExamples(BaseCase): def test_get_and_set_resource_value(self): # an example: get and set a resource value from mbed_cloud.foundation import Device from mbed_cloud import ApiFilter from mbed_cloud.foundation.enums import DeviceStateEnum from mbed_cloud import ConnectAPI # Use the Foundation interface to find a registered device. api_filter = ApiFilter() api_filter.add_filter("state", "eq", DeviceStateEnum.REGISTERED) device = Device().list(max_results=2, filter=api_filter).next() # Use the Legacy interface to find resources connect_api = ConnectAPI() # Find an observable resource for resource in connect_api.list_resources(device.id): if resource.observable: break # Set a resource value connect_api.set_resource_value(device.id, resource.path, "12") # Get a resource value value = connect_api.get_resource_value(device.id, resource.path) print("Device %s, path %s, current value: %s" %(device.id, resource.path, value)) # end of example connect_api.stop_notifications() def test_subscribe(self): # an example: subscribe to resource values from mbed_cloud import ConnectAPI # Create an instance of the Connect API connect_api = ConnectAPI() # Configure a subscription to receive resource value changes on all devices channel = connect_api.subscribe.channels.ResourceValues(device_id="*") # Contact Pelion Device Management to actually make the configured subscription observer = connect_api.subscribe(channel) # Print the subscription notifications received while True: print(observer.next().block()) # end of example break connect_api.subscribe.unsubscribe_all()
class TestExamples(BaseCase): def test_get_and_set_resource_value(self): pass def test_subscribe(self): pass
3
0
25
6
13
7
3
0.5
1
4
4
0
2
0
2
74
53
14
26
16
18
13
26
16
18
3
3
2
5
2,384
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/connect/webhooks.py
mbed_cloud.connect.webhooks.Webhook
class Webhook(BaseObject): """Describes webhook object.""" @staticmethod def _get_attributes_map(): return { "url": "url", "headers": "headers", } @property def url(self): """Get the URL of this Webhook. The URL to which the notifications are sent. We recommend that you serve this URL over HTTPS. :return: The url of this Webhook. :rtype: str """ return self._url @property def headers(self): """Get the headers of this Webhook. Headers (key/value) that are sent with the notification. Optional. :return: The headers of this Webhook. :rtype: dict(str, str) """ return self._headers
class Webhook(BaseObject): '''Describes webhook object.''' @staticmethod def _get_attributes_map(): pass @property def url(self): '''Get the URL of this Webhook. The URL to which the notifications are sent. We recommend that you serve this URL over HTTPS. :return: The url of this Webhook. :rtype: str ''' pass @property def headers(self): '''Get the headers of this Webhook. Headers (key/value) that are sent with the notification. Optional. :return: The headers of this Webhook. :rtype: dict(str, str) ''' pass
7
3
8
1
3
4
1
0.92
1
0
0
0
2
0
3
11
32
7
13
7
6
12
7
4
3
1
2
0
3
2,385
ARMmbed/mbed-cloud-sdk-python
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/billing/billing.py
mbed_cloud.billing.billing.BillingAPI
class BillingAPI(BaseAPI): """API reference for the Billing API.""" api_structure = {billing: [billing.DefaultApi]} @catch_exceptions(BillingAPIException) def get_quota_remaining(self): """Get the remaining value""" api = self._get_api(billing.DefaultApi) quota = api.get_service_package_quota() return None if quota is None else int(quota.quota) @catch_exceptions(BillingAPIException) def get_quota_history(self, **kwargs): """Get quota usage history""" kwargs = self._verify_sort_options(kwargs) kwargs = self._verify_filters(kwargs, ServicePackage) api = self._get_api(billing.DefaultApi) return PaginatedResponse( api.get_service_package_quota_history, lwrap_type=QuotaHistory, **kwargs ) @catch_exceptions(BillingAPIException) def get_service_packages(self): """Get all service packages""" api = self._get_api(billing.DefaultApi) package_response = api.get_service_packages() packages = [] for state in PACKAGE_STATES: # iterate states in order items = getattr(package_response, state) or [] for item in ensure_listable(items): params = item.to_dict() params['state'] = state packages.append(ServicePackage(params)) return packages def _month_converter(self, date_time): """Returns Billing API format YYYY-DD""" if not date_time: date_time = datetime.datetime.utcnow() if isinstance(date_time, datetime.datetime): date_time = '%s-%02d' % (date_time.year, date_time.month) return date_time def _filepath_converter(self, user_path, file_name): """Logic for obtaining a file path :param user_path: a path as provided by the user. perhaps a file or directory? :param file_name: the name of the remote file :return: """ path = user_path or os.path.join( os.getcwd(), 'billing_reports', os.path.sep) dir_specified = path.endswith(os.sep) if dir_specified: path = os.path.join(path, file_name) path = os.path.abspath(path) directory = os.path.dirname(path) if not os.path.isdir(directory): os.makedirs(directory) if os.path.exists(path): raise IOError( 'SDK will not write into an existing path: %r' % path) return path @catch_exceptions(BillingAPIException) def get_report_overview(self, month, file_path): """Downloads a report overview :param month: month as datetime instance, or string in YYYY-MM format :type month: str or datetime :param str file_path: location to store output file :return: outcome :rtype: True or None """ api = self._get_api(billing.DefaultApi) month = self._month_converter(month) response = api.get_billing_report(month=month) if file_path and response: content = api.api_client.sanitize_for_serialization( response.to_dict()) with open(file_path, 'w') as fh: fh.write( json.dumps( content, sort_keys=True, indent=2, ) ) return response @catch_exceptions(BillingAPIException) def get_report_active_devices(self, month=None, file_path=None): """Downloads a report of the active devices :param str file_path: [optional] location to store output file :param month: [default: utcnow] month as datetime instance, or string in YYYY-MM format :type month: str or datetime :return: The report structure :rtype: dict """ api = self._get_api(billing.DefaultApi) month = self._month_converter(month) response = api.get_billing_report_active_devices(month=month) download_url = response.url file_path = self._filepath_converter(file_path, response.filename) if file_path: urllib.request.urlretrieve(download_url, file_path) return response @catch_exceptions(BillingAPIException) def get_report_firmware_updates(self, month=None, file_path=None): """Downloads a report of the firmware updates :param str file_path: [optional] location to store output file :param month: [default: utcnow] month as datetime instance, or string in YYYY-MM format :type month: str or datetime :return: The report structure :rtype: dict """ api = self._get_api(billing.DefaultApi) month = self._month_converter(month) response = api.get_billing_report_firmware_updates(month=month) download_url = response.url file_path = self._filepath_converter(file_path, response.filename) if file_path: urllib.request.urlretrieve(download_url, file_path) return response
class BillingAPI(BaseAPI): '''API reference for the Billing API.''' @catch_exceptions(BillingAPIException) def get_quota_remaining(self): '''Get the remaining value''' pass @catch_exceptions(BillingAPIException) def get_quota_history(self, **kwargs): '''Get quota usage history''' pass @catch_exceptions(BillingAPIException) def get_service_packages(self): '''Get all service packages''' pass def _month_converter(self, date_time): '''Returns Billing API format YYYY-DD''' pass def _filepath_converter(self, user_path, file_name): '''Logic for obtaining a file path :param user_path: a path as provided by the user. perhaps a file or directory? :param file_name: the name of the remote file :return: ''' pass @catch_exceptions(BillingAPIException) def get_report_overview(self, month, file_path): '''Downloads a report overview :param month: month as datetime instance, or string in YYYY-MM format :type month: str or datetime :param str file_path: location to store output file :return: outcome :rtype: True or None ''' pass @catch_exceptions(BillingAPIException) def get_report_active_devices(self, month=None, file_path=None): '''Downloads a report of the active devices :param str file_path: [optional] location to store output file :param month: [default: utcnow] month as datetime instance, or string in YYYY-MM format :type month: str or datetime :return: The report structure :rtype: dict ''' pass @catch_exceptions(BillingAPIException) def get_report_firmware_updates(self, month=None, file_path=None): '''Downloads a report of the firmware updates :param str file_path: [optional] location to store output file :param month: [default: utcnow] month as datetime instance, or string in YYYY-MM format :type month: str or datetime :return: The report structure :rtype: dict ''' pass
15
9
14
1
9
4
2
0.39
1
6
4
0
8
0
8
15
133
18
83
39
68
32
67
32
58
4
2
2
19
2,386
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/connect/presubscription.py
mbed_cloud.connect.presubscription.Presubscription
class Presubscription(BaseObject): """Presubscription data object""" @staticmethod def _get_attributes_map(): return { 'device_id': 'endpoint-name', 'device_type': 'endpoint-type', 'resource_paths': 'resource-path', } @property def device_id(self): """The Device ID :return: The URL of this Webhook. :rtype: str """ return self._device_id @property def device_type(self): """Device type of this Presubscription. :return: The URL of this Webhook. :rtype: str """ return self._device_type @property def resource_paths(self): """Resource paths of this Presubscription. :return: The URL of this Webhook. :rtype: list[str] """ return self._resource_paths
class Presubscription(BaseObject): '''Presubscription data object''' @staticmethod def _get_attributes_map(): pass @property def device_id(self): '''The Device ID :return: The URL of this Webhook. :rtype: str ''' pass @property def device_type(self): '''Device type of this Presubscription. :return: The URL of this Webhook. :rtype: str ''' pass @property def resource_paths(self): '''Resource paths of this Presubscription. :return: The URL of this Webhook. :rtype: list[str] ''' pass
9
4
7
1
3
3
1
0.76
1
0
0
0
3
0
4
12
37
7
17
9
8
13
9
5
4
1
2
0
4
2,387
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/external_ca/apis/certificate_issuers_api.py
mbed_cloud._backends.external_ca.apis.certificate_issuers_api.CertificateIssuersApi
class CertificateIssuersApi(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client def create_certificate_issuer(self, certificate_issuer_request, **kwargs): # noqa: E501 """Create certificate issuer. # noqa: E501 Create a certificate issuer. The maximum number of issuers is limited to 20 per account. Multiple certificate issuers of the same issuer type can be created, provided they have a different name. This allows verification of the certificate issuer configuration before activating it. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: Bearer <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers \\ -d '{ \"issuer_type\": \"GLOBAL_SIGN\", \"name\": \"GS Issuer\", \"description\": \"Sample GlobalSign certificate issuer\", \"issuer_attributes\": null, \"issuer_credentials\": { \"api_key\": \"e510e289e6cd8947\", \"api_secret\": \"a477a8393d17a55ecb2ba6a61f58feb84770b621\", \"client_certificate\": \"-----BEGIN CERTIFICATE-----MIIC7zCCAdegAwIBAgIJANTlU4x5S74VMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNVBAoMA0FybTAeFw0xODAzMTExMzE5MTFaFw0xOTAzMTExMzE5MTFaMA4xDDAKBgNVBAoMA0FybTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJWLStsVMJULZtxdieK9qocM4ymDXMaAusmd9TZLzBgznKQe/CW2yxyA8C8K5e6MmvMYGeKDd4Lkw/ezOj2OsUj2xzNIltUxpGi/GhsNYiN/khNJa/Y1SllLoihJAPm/xbMywOBRu/dM88PiJsNZccOk0I8DYvvyAs9wCTkbKLnfHygl98DCRqXw7nBCplU6F03qpUd/4BUtMtugyqt7yboGH+4YewnUh4Yh4QNOJIvE93Ob++eKjO3pIOYEhQmUxzOLaLNuWXlv2l1WuN281hUP4XBcV8mCzRQfTBBDYTWt+5BEWoLOUkXjW0Um6EAaN3usph1IKDEH6Ia5VHP4Pj0CAwEAAaNQME4wHQYDVR0OBBYEFLsfYZxFcQTjPJKYMjHI2In316fmMB8GA1UdIwQYMBaAFLsfYZxFcQTjPJKYMjHI2In316fmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFl08GFsIkkUs6M7QgCWmsnwP6PtD8V87wM1GAqQQlOOeztaeRR2TEOeYiKRZQugYszJ/FVfVp4ggqzepJMn6UZ42j5nmSJs+6t79i23QAzX1zNQ354lr/t7kt3fMdhuL3AP0oZGzdy+EnXXiWeAD22UwzvVmLt38ypJIl+pmTsx9jJy4PN7yoRgtP9k+50m3X6oDxVruehC/JPSeTvEhqyLW3fLcG6IoJMX3vIwfO9uXbFJumTowQeViNJJ9duWvD2KBXn/muOOBe97TPuvAms1gOtMmmPT9/jpo9b4+NsfFiAN6bMici81aIKZzLC+lLGOUmR2fFJyM5OsVLxKsko=-----END CERTIFICATE-----\", \"private_key\":\"-----BEGIN RSA PRIVATE KEY-----\\nProc-Type: 4,ENCRYPTED\\nDEK-Info: DES-EDE3-CBC,CCAC26A4133947CB\\n\\np3KJ4FI3wcz3I0MtiLkrznkjWFvprVmoNywySUGb5IqZViJZqCMEsyU9a9iDsSfP\\nZ07cg9GviV21WYIPSxZOQrpy1g1VWILzFnH+J6z8dSH4mxXh0PwdOzYgAeqkrIVM\\nJ7KRm6t222dZFjjXK3eEcLmBLGo29XwVJxKHx+l4++gU1LZmeHZR5M8fJ4jejUly\\n7sqzPlmRF0N3I4lwKVj+PfQTVz43QoCnpxOjuSEL4liBrc2agY2xH1O0PFyHimz9\\n3XM9HR/iuPHW0N2D+NPjXlWKacerupH9d4i9IYIagzB+HTgej8limdo03GmmxcZ6\\nYNa58n5yQSaqu0TPRU9DsrKeGjadHTlZQGdzfq1SWsROCnHLrXFKE2ozIG3+hxA5\\nujBF/QWpX5+inXUwDJhBxp8isHbPEnBEUUd6ZRzCTjvN0jaUti5B9yFhO2G6mbE8\\nCvhyzQK8oJqsjZXnlcpPf95LP+9XbcCDjLSIaWJstzXO9tPiv6+x1MVWmivtRHcC\\nSTzpx8jAGCiG6ejLqWB87ZXiZm7ujlCBheHSf5RHwNHhUvoP2JEYalDDRxjcDMSx\\n4uV42Np4yJlIQEDlGHcBlXoL7vEukFpuWgkYdpcZy/Ou9qz8mXrpLcu8C8MhLmSC\\nixGoR5iRhV7cxoHLyuCzj87eYEA73Xu238DQorSEEuiVFnLzQ2+PJMs4qoI14q/L\\notlBDz+Ko6DrU/EZROYmiqMkLKXR2sx9zNAJwPYRs6nSH08tZ3dwqzZbgtP3Wazi\\nhLWHt5/En7wQRA5a+/dDEHXSoLvvSQ9jvhclhWf+eCYuq2eH+g54oyJGRSY+8GV7\\nujhLxkzl/3OZdhZPWoz4U13KpbSTcNWu5Y7oGDoabw19UbvqmLf1PJkpDH/tQgzB\\nxYtsLBRUcofpYoeIiIxfAA4do5WilJc8xqrGhkE4WcHfY24HXAiOvsjbxV+BRprX\\n1jtgJpV/9nJESMap+8PxipGUFRGjB83/uwJaa6mLftEKflX8i4MZ+HnqraXERsqA\\nWRUcDHIWmFfpzIB3iNuxawVvPH8NdCSPmQ9qTb8Cozl0AuOK2E9S+ke8oiYQScWR\\nLdu+zhej7GjuQ9R+Ub+wPWqvOA5qLXejqnCexVScDUuN+z9JWM3N2FG1MwxhAzhP\\ndEfoQHoBn6uyOmrVGP6fosV3chqhPoec42KeOAm1xDvx692isaIy1jPgIyPxeqhm\\n2Tw4E+02R7dlP8Ljf7JzfLm4oKpWHWlcHeqg24x6lY/wXU1RBcWaTa0AQUwoGm2m\\nIQCPfIqOEv/QC2HpO7SVCYkl65KwR0oTd1AzYxdxEq3xHQbh69EL0FGZPVxVCPI+\\nhEAyifKy1/tm3l91Rf/kGpHY7nIQKCXH49tmFwix8gke2nZJmRgX7/zAdMOAKeKH\\nAaIl4nQtv14EbaasMgnn9qgaDYnWzaReEob2QlQ/WYlTor61+KFpGtcf9jAkgudT\\n2op+4CF7wT2+aTXdtkVWfmv++iB8GnlqZdxLvyG1cTYjjYHVFbMSWQnxzQqiE2ms\\nQgp+byjWCumpsWTMdTO+d9NkDOo80vDpaRxEgebmhJ0MbX+eFjBgVg==\\n-----END RSA PRIVATE KEY-----\", \"passphrase\": \"helloworld\" } }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer(certificate_issuer_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerRequest certificate_issuer_request: Certificate issuer request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.create_certificate_issuer_with_http_info(certificate_issuer_request, **kwargs) # noqa: E501 else: (data) = self.create_certificate_issuer_with_http_info(certificate_issuer_request, **kwargs) # noqa: E501 return data def create_certificate_issuer_with_http_info(self, certificate_issuer_request, **kwargs): # noqa: E501 """Create certificate issuer. # noqa: E501 Create a certificate issuer. The maximum number of issuers is limited to 20 per account. Multiple certificate issuers of the same issuer type can be created, provided they have a different name. This allows verification of the certificate issuer configuration before activating it. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: Bearer <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers \\ -d '{ \"issuer_type\": \"GLOBAL_SIGN\", \"name\": \"GS Issuer\", \"description\": \"Sample GlobalSign certificate issuer\", \"issuer_attributes\": null, \"issuer_credentials\": { \"api_key\": \"e510e289e6cd8947\", \"api_secret\": \"a477a8393d17a55ecb2ba6a61f58feb84770b621\", \"client_certificate\": \"-----BEGIN CERTIFICATE-----MIIC7zCCAdegAwIBAgIJANTlU4x5S74VMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNVBAoMA0FybTAeFw0xODAzMTExMzE5MTFaFw0xOTAzMTExMzE5MTFaMA4xDDAKBgNVBAoMA0FybTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJWLStsVMJULZtxdieK9qocM4ymDXMaAusmd9TZLzBgznKQe/CW2yxyA8C8K5e6MmvMYGeKDd4Lkw/ezOj2OsUj2xzNIltUxpGi/GhsNYiN/khNJa/Y1SllLoihJAPm/xbMywOBRu/dM88PiJsNZccOk0I8DYvvyAs9wCTkbKLnfHygl98DCRqXw7nBCplU6F03qpUd/4BUtMtugyqt7yboGH+4YewnUh4Yh4QNOJIvE93Ob++eKjO3pIOYEhQmUxzOLaLNuWXlv2l1WuN281hUP4XBcV8mCzRQfTBBDYTWt+5BEWoLOUkXjW0Um6EAaN3usph1IKDEH6Ia5VHP4Pj0CAwEAAaNQME4wHQYDVR0OBBYEFLsfYZxFcQTjPJKYMjHI2In316fmMB8GA1UdIwQYMBaAFLsfYZxFcQTjPJKYMjHI2In316fmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFl08GFsIkkUs6M7QgCWmsnwP6PtD8V87wM1GAqQQlOOeztaeRR2TEOeYiKRZQugYszJ/FVfVp4ggqzepJMn6UZ42j5nmSJs+6t79i23QAzX1zNQ354lr/t7kt3fMdhuL3AP0oZGzdy+EnXXiWeAD22UwzvVmLt38ypJIl+pmTsx9jJy4PN7yoRgtP9k+50m3X6oDxVruehC/JPSeTvEhqyLW3fLcG6IoJMX3vIwfO9uXbFJumTowQeViNJJ9duWvD2KBXn/muOOBe97TPuvAms1gOtMmmPT9/jpo9b4+NsfFiAN6bMici81aIKZzLC+lLGOUmR2fFJyM5OsVLxKsko=-----END CERTIFICATE-----\", \"private_key\":\"-----BEGIN RSA PRIVATE KEY-----\\nProc-Type: 4,ENCRYPTED\\nDEK-Info: DES-EDE3-CBC,CCAC26A4133947CB\\n\\np3KJ4FI3wcz3I0MtiLkrznkjWFvprVmoNywySUGb5IqZViJZqCMEsyU9a9iDsSfP\\nZ07cg9GviV21WYIPSxZOQrpy1g1VWILzFnH+J6z8dSH4mxXh0PwdOzYgAeqkrIVM\\nJ7KRm6t222dZFjjXK3eEcLmBLGo29XwVJxKHx+l4++gU1LZmeHZR5M8fJ4jejUly\\n7sqzPlmRF0N3I4lwKVj+PfQTVz43QoCnpxOjuSEL4liBrc2agY2xH1O0PFyHimz9\\n3XM9HR/iuPHW0N2D+NPjXlWKacerupH9d4i9IYIagzB+HTgej8limdo03GmmxcZ6\\nYNa58n5yQSaqu0TPRU9DsrKeGjadHTlZQGdzfq1SWsROCnHLrXFKE2ozIG3+hxA5\\nujBF/QWpX5+inXUwDJhBxp8isHbPEnBEUUd6ZRzCTjvN0jaUti5B9yFhO2G6mbE8\\nCvhyzQK8oJqsjZXnlcpPf95LP+9XbcCDjLSIaWJstzXO9tPiv6+x1MVWmivtRHcC\\nSTzpx8jAGCiG6ejLqWB87ZXiZm7ujlCBheHSf5RHwNHhUvoP2JEYalDDRxjcDMSx\\n4uV42Np4yJlIQEDlGHcBlXoL7vEukFpuWgkYdpcZy/Ou9qz8mXrpLcu8C8MhLmSC\\nixGoR5iRhV7cxoHLyuCzj87eYEA73Xu238DQorSEEuiVFnLzQ2+PJMs4qoI14q/L\\notlBDz+Ko6DrU/EZROYmiqMkLKXR2sx9zNAJwPYRs6nSH08tZ3dwqzZbgtP3Wazi\\nhLWHt5/En7wQRA5a+/dDEHXSoLvvSQ9jvhclhWf+eCYuq2eH+g54oyJGRSY+8GV7\\nujhLxkzl/3OZdhZPWoz4U13KpbSTcNWu5Y7oGDoabw19UbvqmLf1PJkpDH/tQgzB\\nxYtsLBRUcofpYoeIiIxfAA4do5WilJc8xqrGhkE4WcHfY24HXAiOvsjbxV+BRprX\\n1jtgJpV/9nJESMap+8PxipGUFRGjB83/uwJaa6mLftEKflX8i4MZ+HnqraXERsqA\\nWRUcDHIWmFfpzIB3iNuxawVvPH8NdCSPmQ9qTb8Cozl0AuOK2E9S+ke8oiYQScWR\\nLdu+zhej7GjuQ9R+Ub+wPWqvOA5qLXejqnCexVScDUuN+z9JWM3N2FG1MwxhAzhP\\ndEfoQHoBn6uyOmrVGP6fosV3chqhPoec42KeOAm1xDvx692isaIy1jPgIyPxeqhm\\n2Tw4E+02R7dlP8Ljf7JzfLm4oKpWHWlcHeqg24x6lY/wXU1RBcWaTa0AQUwoGm2m\\nIQCPfIqOEv/QC2HpO7SVCYkl65KwR0oTd1AzYxdxEq3xHQbh69EL0FGZPVxVCPI+\\nhEAyifKy1/tm3l91Rf/kGpHY7nIQKCXH49tmFwix8gke2nZJmRgX7/zAdMOAKeKH\\nAaIl4nQtv14EbaasMgnn9qgaDYnWzaReEob2QlQ/WYlTor61+KFpGtcf9jAkgudT\\n2op+4CF7wT2+aTXdtkVWfmv++iB8GnlqZdxLvyG1cTYjjYHVFbMSWQnxzQqiE2ms\\nQgp+byjWCumpsWTMdTO+d9NkDOo80vDpaRxEgebmhJ0MbX+eFjBgVg==\\n-----END RSA PRIVATE KEY-----\", \"passphrase\": \"helloworld\" } }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_with_http_info(certificate_issuer_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerRequest certificate_issuer_request: Certificate issuer request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_request'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_certificate_issuer" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_request' is set if ('certificate_issuer_request' not in params or params['certificate_issuer_request'] is None): raise ValueError("Missing the required parameter `certificate_issuer_request` when calling `create_certificate_issuer`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'certificate_issuer_request' in params: body_params = params['certificate_issuer_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerInfo', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def delete_certificate_issuer(self, certificate_issuer_id, **kwargs): # noqa: E501 """Delete certificate issuer. # noqa: E501 Delete a certificate issuer by ID. <br> **Example usage:** ``` curl -X DELETE \\ -H 'authorization: <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/0162155dc77d507b9d48a91b00000000 ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. An active certificate issuer may not be deleted. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.delete_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 else: (data) = self.delete_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 return data def delete_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): # noqa: E501 """Delete certificate issuer. # noqa: E501 Delete a certificate issuer by ID. <br> **Example usage:** ``` curl -X DELETE \\ -H 'authorization: <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/0162155dc77d507b9d48a91b00000000 ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. An active certificate issuer may not be deleted. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_certificate_issuer" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_id' is set if ('certificate_issuer_id' not in params or params['certificate_issuer_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_id` when calling `delete_certificate_issuer`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_id' in params: path_params['certificate-issuer-id'] = params['certificate_issuer_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers/{certificate-issuer-id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_certificate_issuer(self, certificate_issuer_id, **kwargs): # noqa: E501 """Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. The ID of the certificate issuer. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 else: (data) = self.get_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 return data def get_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): # noqa: E501 """Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. The ID of the certificate issuer. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_certificate_issuer" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_id' is set if ('certificate_issuer_id' not in params or params['certificate_issuer_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_id` when calling `get_certificate_issuer`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_id' in params: path_params['certificate-issuer-id'] = params['certificate_issuer_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers/{certificate-issuer-id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerInfo', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_certificate_issuers(self, **kwargs): # noqa: E501 """Get certificate issuers list. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuers(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerInfoListResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_certificate_issuers_with_http_info(**kwargs) # noqa: E501 else: (data) = self.get_certificate_issuers_with_http_info(**kwargs) # noqa: E501 return data def get_certificate_issuers_with_http_info(self, **kwargs): # noqa: E501 """Get certificate issuers list. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuers_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerInfoListResponse If the method is called asynchronously, returns the request thread. """ all_params = [] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_certificate_issuers" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerInfoListResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def update_certificate_issuer(self, certificate_issuer_id, certificate_issuer_update_request, **kwargs): # noqa: E501 """Update certificate issuer. # noqa: E501 Update a certificate issuer. <br> **Example usage:** ``` curl -X PUT \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621560be51507b9d48a91b00000000 \\ -d '{ \"description\": \"Sample GlobalSign certificate issuer - updated.\", \"name\": \"GlobalSign Issuer\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer(certificate_issuer_id, certificate_issuer_update_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :param CertificateIssuerUpdateRequest certificate_issuer_update_request: Certificate issuer update request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.update_certificate_issuer_with_http_info(certificate_issuer_id, certificate_issuer_update_request, **kwargs) # noqa: E501 else: (data) = self.update_certificate_issuer_with_http_info(certificate_issuer_id, certificate_issuer_update_request, **kwargs) # noqa: E501 return data def update_certificate_issuer_with_http_info(self, certificate_issuer_id, certificate_issuer_update_request, **kwargs): # noqa: E501 """Update certificate issuer. # noqa: E501 Update a certificate issuer. <br> **Example usage:** ``` curl -X PUT \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621560be51507b9d48a91b00000000 \\ -d '{ \"description\": \"Sample GlobalSign certificate issuer - updated.\", \"name\": \"GlobalSign Issuer\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_with_http_info(certificate_issuer_id, certificate_issuer_update_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :param CertificateIssuerUpdateRequest certificate_issuer_update_request: Certificate issuer update request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_id', 'certificate_issuer_update_request'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method update_certificate_issuer" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_id' is set if ('certificate_issuer_id' not in params or params['certificate_issuer_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_id` when calling `update_certificate_issuer`") # noqa: E501 # verify the required parameter 'certificate_issuer_update_request' is set if ('certificate_issuer_update_request' not in params or params['certificate_issuer_update_request'] is None): raise ValueError("Missing the required parameter `certificate_issuer_update_request` when calling `update_certificate_issuer`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_id' in params: path_params['certificate-issuer-id'] = params['certificate_issuer_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'certificate_issuer_update_request' in params: body_params = params['certificate_issuer_update_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers/{certificate-issuer-id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerInfo', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def verify_certificate_issuer(self, certificate_issuer_id, **kwargs): # noqa: E501 """Verify certificate issuer. # noqa: E501 A utility API that can be used to validate the user configuration before activating a certificate issuer. Verifies that the certificate issuer is accessible and can be used to generate certificates by Device Management. <br> **Note:** The API requests the 3rd party CA to sign a test certificate. For some 3rd party CAs, this operation may make use of the account quota. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621a36719d507b9d48a91b00000000/verify ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.verify_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :return: CertificateIssuerVerifyResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.verify_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 else: (data) = self.verify_certificate_issuer_with_http_info(certificate_issuer_id, **kwargs) # noqa: E501 return data def verify_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): # noqa: E501 """Verify certificate issuer. # noqa: E501 A utility API that can be used to validate the user configuration before activating a certificate issuer. Verifies that the certificate issuer is accessible and can be used to generate certificates by Device Management. <br> **Note:** The API requests the 3rd party CA to sign a test certificate. For some 3rd party CAs, this operation may make use of the account quota. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621a36719d507b9d48a91b00000000/verify ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.verify_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :return: CertificateIssuerVerifyResponse If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method verify_certificate_issuer" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_id' is set if ('certificate_issuer_id' not in params or params['certificate_issuer_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_id` when calling `verify_certificate_issuer`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_id' in params: path_params['certificate-issuer-id'] = params['certificate_issuer_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuers/{certificate-issuer-id}/verify', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerVerifyResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
class CertificateIssuersApi(object): '''NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen ''' def __init__(self, api_client=None): pass def create_certificate_issuer(self, certificate_issuer_request, **kwargs): '''Create certificate issuer. # noqa: E501 Create a certificate issuer. The maximum number of issuers is limited to 20 per account. Multiple certificate issuers of the same issuer type can be created, provided they have a different name. This allows verification of the certificate issuer configuration before activating it. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: Bearer <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers \ -d '{ "issuer_type": "GLOBAL_SIGN", "name": "GS Issuer", "description": "Sample GlobalSign certificate issuer", "issuer_attributes": null, "issuer_credentials": { "api_key": "e510e289e6cd8947", "api_secret": "a477a8393d17a55ecb2ba6a61f58feb84770b621", "client_certificate": "-----BEGIN CERTIFICATE-----MIIC7zCCAdegAwIBAgIJANTlU4x5S74VMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNVBAoMA0FybTAeFw0xODAzMTExMzE5MTFaFw0xOTAzMTExMzE5MTFaMA4xDDAKBgNVBAoMA0FybTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJWLStsVMJULZtxdieK9qocM4ymDXMaAusmd9TZLzBgznKQe/CW2yxyA8C8K5e6MmvMYGeKDd4Lkw/ezOj2OsUj2xzNIltUxpGi/GhsNYiN/khNJa/Y1SllLoihJAPm/xbMywOBRu/dM88PiJsNZccOk0I8DYvvyAs9wCTkbKLnfHygl98DCRqXw7nBCplU6F03qpUd/4BUtMtugyqt7yboGH+4YewnUh4Yh4QNOJIvE93Ob++eKjO3pIOYEhQmUxzOLaLNuWXlv2l1WuN281hUP4XBcV8mCzRQfTBBDYTWt+5BEWoLOUkXjW0Um6EAaN3usph1IKDEH6Ia5VHP4Pj0CAwEAAaNQME4wHQYDVR0OBBYEFLsfYZxFcQTjPJKYMjHI2In316fmMB8GA1UdIwQYMBaAFLsfYZxFcQTjPJKYMjHI2In316fmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFl08GFsIkkUs6M7QgCWmsnwP6PtD8V87wM1GAqQQlOOeztaeRR2TEOeYiKRZQugYszJ/FVfVp4ggqzepJMn6UZ42j5nmSJs+6t79i23QAzX1zNQ354lr/t7kt3fMdhuL3AP0oZGzdy+EnXXiWeAD22UwzvVmLt38ypJIl+pmTsx9jJy4PN7yoRgtP9k+50m3X6oDxVruehC/JPSeTvEhqyLW3fLcG6IoJMX3vIwfO9uXbFJumTowQeViNJJ9duWvD2KBXn/muOOBe97TPuvAms1gOtMmmPT9/jpo9b4+NsfFiAN6bMici81aIKZzLC+lLGOUmR2fFJyM5OsVLxKsko=-----END CERTIFICATE-----", "private_key":"-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: DES-EDE3-CBC,CCAC26A4133947CB\n\np3KJ4FI3wcz3I0MtiLkrznkjWFvprVmoNywySUGb5IqZViJZqCMEsyU9a9iDsSfP\nZ07cg9GviV21WYIPSxZOQrpy1g1VWILzFnH+J6z8dSH4mxXh0PwdOzYgAeqkrIVM\nJ7KRm6t222dZFjjXK3eEcLmBLGo29XwVJxKHx+l4++gU1LZmeHZR5M8fJ4jejUly\n7sqzPlmRF0N3I4lwKVj+PfQTVz43QoCnpxOjuSEL4liBrc2agY2xH1O0PFyHimz9\n3XM9HR/iuPHW0N2D+NPjXlWKacerupH9d4i9IYIagzB+HTgej8limdo03GmmxcZ6\nYNa58n5yQSaqu0TPRU9DsrKeGjadHTlZQGdzfq1SWsROCnHLrXFKE2ozIG3+hxA5\nujBF/QWpX5+inXUwDJhBxp8isHbPEnBEUUd6ZRzCTjvN0jaUti5B9yFhO2G6mbE8\nCvhyzQK8oJqsjZXnlcpPf95LP+9XbcCDjLSIaWJstzXO9tPiv6+x1MVWmivtRHcC\nSTzpx8jAGCiG6ejLqWB87ZXiZm7ujlCBheHSf5RHwNHhUvoP2JEYalDDRxjcDMSx\n4uV42Np4yJlIQEDlGHcBlXoL7vEukFpuWgkYdpcZy/Ou9qz8mXrpLcu8C8MhLmSC\nixGoR5iRhV7cxoHLyuCzj87eYEA73Xu238DQorSEEuiVFnLzQ2+PJMs4qoI14q/L\notlBDz+Ko6DrU/EZROYmiqMkLKXR2sx9zNAJwPYRs6nSH08tZ3dwqzZbgtP3Wazi\nhLWHt5/En7wQRA5a+/dDEHXSoLvvSQ9jvhclhWf+eCYuq2eH+g54oyJGRSY+8GV7\nujhLxkzl/3OZdhZPWoz4U13KpbSTcNWu5Y7oGDoabw19UbvqmLf1PJkpDH/tQgzB\nxYtsLBRUcofpYoeIiIxfAA4do5WilJc8xqrGhkE4WcHfY24HXAiOvsjbxV+BRprX\n1jtgJpV/9nJESMap+8PxipGUFRGjB83/uwJaa6mLftEKflX8i4MZ+HnqraXERsqA\nWRUcDHIWmFfpzIB3iNuxawVvPH8NdCSPmQ9qTb8Cozl0AuOK2E9S+ke8oiYQScWR\nLdu+zhej7GjuQ9R+Ub+wPWqvOA5qLXejqnCexVScDUuN+z9JWM3N2FG1MwxhAzhP\ndEfoQHoBn6uyOmrVGP6fosV3chqhPoec42KeOAm1xDvx692isaIy1jPgIyPxeqhm\n2Tw4E+02R7dlP8Ljf7JzfLm4oKpWHWlcHeqg24x6lY/wXU1RBcWaTa0AQUwoGm2m\nIQCPfIqOEv/QC2HpO7SVCYkl65KwR0oTd1AzYxdxEq3xHQbh69EL0FGZPVxVCPI+\nhEAyifKy1/tm3l91Rf/kGpHY7nIQKCXH49tmFwix8gke2nZJmRgX7/zAdMOAKeKH\nAaIl4nQtv14EbaasMgnn9qgaDYnWzaReEob2QlQ/WYlTor61+KFpGtcf9jAkgudT\n2op+4CF7wT2+aTXdtkVWfmv++iB8GnlqZdxLvyG1cTYjjYHVFbMSWQnxzQqiE2ms\nQgp+byjWCumpsWTMdTO+d9NkDOo80vDpaRxEgebmhJ0MbX+eFjBgVg==\n-----END RSA PRIVATE KEY-----", "passphrase": "helloworld" } }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer(certificate_issuer_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerRequest certificate_issuer_request: Certificate issuer request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def create_certificate_issuer_with_http_info(self, certificate_issuer_request, **kwargs): '''Create certificate issuer. # noqa: E501 Create a certificate issuer. The maximum number of issuers is limited to 20 per account. Multiple certificate issuers of the same issuer type can be created, provided they have a different name. This allows verification of the certificate issuer configuration before activating it. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: Bearer <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers \ -d '{ "issuer_type": "GLOBAL_SIGN", "name": "GS Issuer", "description": "Sample GlobalSign certificate issuer", "issuer_attributes": null, "issuer_credentials": { "api_key": "e510e289e6cd8947", "api_secret": "a477a8393d17a55ecb2ba6a61f58feb84770b621", "client_certificate": "-----BEGIN CERTIFICATE-----MIIC7zCCAdegAwIBAgIJANTlU4x5S74VMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNVBAoMA0FybTAeFw0xODAzMTExMzE5MTFaFw0xOTAzMTExMzE5MTFaMA4xDDAKBgNVBAoMA0FybTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJWLStsVMJULZtxdieK9qocM4ymDXMaAusmd9TZLzBgznKQe/CW2yxyA8C8K5e6MmvMYGeKDd4Lkw/ezOj2OsUj2xzNIltUxpGi/GhsNYiN/khNJa/Y1SllLoihJAPm/xbMywOBRu/dM88PiJsNZccOk0I8DYvvyAs9wCTkbKLnfHygl98DCRqXw7nBCplU6F03qpUd/4BUtMtugyqt7yboGH+4YewnUh4Yh4QNOJIvE93Ob++eKjO3pIOYEhQmUxzOLaLNuWXlv2l1WuN281hUP4XBcV8mCzRQfTBBDYTWt+5BEWoLOUkXjW0Um6EAaN3usph1IKDEH6Ia5VHP4Pj0CAwEAAaNQME4wHQYDVR0OBBYEFLsfYZxFcQTjPJKYMjHI2In316fmMB8GA1UdIwQYMBaAFLsfYZxFcQTjPJKYMjHI2In316fmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFl08GFsIkkUs6M7QgCWmsnwP6PtD8V87wM1GAqQQlOOeztaeRR2TEOeYiKRZQugYszJ/FVfVp4ggqzepJMn6UZ42j5nmSJs+6t79i23QAzX1zNQ354lr/t7kt3fMdhuL3AP0oZGzdy+EnXXiWeAD22UwzvVmLt38ypJIl+pmTsx9jJy4PN7yoRgtP9k+50m3X6oDxVruehC/JPSeTvEhqyLW3fLcG6IoJMX3vIwfO9uXbFJumTowQeViNJJ9duWvD2KBXn/muOOBe97TPuvAms1gOtMmmPT9/jpo9b4+NsfFiAN6bMici81aIKZzLC+lLGOUmR2fFJyM5OsVLxKsko=-----END CERTIFICATE-----", "private_key":"-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: DES-EDE3-CBC,CCAC26A4133947CB\n\np3KJ4FI3wcz3I0MtiLkrznkjWFvprVmoNywySUGb5IqZViJZqCMEsyU9a9iDsSfP\nZ07cg9GviV21WYIPSxZOQrpy1g1VWILzFnH+J6z8dSH4mxXh0PwdOzYgAeqkrIVM\nJ7KRm6t222dZFjjXK3eEcLmBLGo29XwVJxKHx+l4++gU1LZmeHZR5M8fJ4jejUly\n7sqzPlmRF0N3I4lwKVj+PfQTVz43QoCnpxOjuSEL4liBrc2agY2xH1O0PFyHimz9\n3XM9HR/iuPHW0N2D+NPjXlWKacerupH9d4i9IYIagzB+HTgej8limdo03GmmxcZ6\nYNa58n5yQSaqu0TPRU9DsrKeGjadHTlZQGdzfq1SWsROCnHLrXFKE2ozIG3+hxA5\nujBF/QWpX5+inXUwDJhBxp8isHbPEnBEUUd6ZRzCTjvN0jaUti5B9yFhO2G6mbE8\nCvhyzQK8oJqsjZXnlcpPf95LP+9XbcCDjLSIaWJstzXO9tPiv6+x1MVWmivtRHcC\nSTzpx8jAGCiG6ejLqWB87ZXiZm7ujlCBheHSf5RHwNHhUvoP2JEYalDDRxjcDMSx\n4uV42Np4yJlIQEDlGHcBlXoL7vEukFpuWgkYdpcZy/Ou9qz8mXrpLcu8C8MhLmSC\nixGoR5iRhV7cxoHLyuCzj87eYEA73Xu238DQorSEEuiVFnLzQ2+PJMs4qoI14q/L\notlBDz+Ko6DrU/EZROYmiqMkLKXR2sx9zNAJwPYRs6nSH08tZ3dwqzZbgtP3Wazi\nhLWHt5/En7wQRA5a+/dDEHXSoLvvSQ9jvhclhWf+eCYuq2eH+g54oyJGRSY+8GV7\nujhLxkzl/3OZdhZPWoz4U13KpbSTcNWu5Y7oGDoabw19UbvqmLf1PJkpDH/tQgzB\nxYtsLBRUcofpYoeIiIxfAA4do5WilJc8xqrGhkE4WcHfY24HXAiOvsjbxV+BRprX\n1jtgJpV/9nJESMap+8PxipGUFRGjB83/uwJaa6mLftEKflX8i4MZ+HnqraXERsqA\nWRUcDHIWmFfpzIB3iNuxawVvPH8NdCSPmQ9qTb8Cozl0AuOK2E9S+ke8oiYQScWR\nLdu+zhej7GjuQ9R+Ub+wPWqvOA5qLXejqnCexVScDUuN+z9JWM3N2FG1MwxhAzhP\ndEfoQHoBn6uyOmrVGP6fosV3chqhPoec42KeOAm1xDvx692isaIy1jPgIyPxeqhm\n2Tw4E+02R7dlP8Ljf7JzfLm4oKpWHWlcHeqg24x6lY/wXU1RBcWaTa0AQUwoGm2m\nIQCPfIqOEv/QC2HpO7SVCYkl65KwR0oTd1AzYxdxEq3xHQbh69EL0FGZPVxVCPI+\nhEAyifKy1/tm3l91Rf/kGpHY7nIQKCXH49tmFwix8gke2nZJmRgX7/zAdMOAKeKH\nAaIl4nQtv14EbaasMgnn9qgaDYnWzaReEob2QlQ/WYlTor61+KFpGtcf9jAkgudT\n2op+4CF7wT2+aTXdtkVWfmv++iB8GnlqZdxLvyG1cTYjjYHVFbMSWQnxzQqiE2ms\nQgp+byjWCumpsWTMdTO+d9NkDOo80vDpaRxEgebmhJ0MbX+eFjBgVg==\n-----END RSA PRIVATE KEY-----", "passphrase": "helloworld" } }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_with_http_info(certificate_issuer_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerRequest certificate_issuer_request: Certificate issuer request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def delete_certificate_issuer(self, certificate_issuer_id, **kwargs): '''Delete certificate issuer. # noqa: E501 Delete a certificate issuer by ID. <br> **Example usage:** ``` curl -X DELETE \ -H 'authorization: <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/0162155dc77d507b9d48a91b00000000 ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. An active certificate issuer may not be deleted. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def delete_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): '''Delete certificate issuer. # noqa: E501 Delete a certificate issuer by ID. <br> **Example usage:** ``` curl -X DELETE \ -H 'authorization: <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/0162155dc77d507b9d48a91b00000000 ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. An active certificate issuer may not be deleted. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer(self, certificate_issuer_id, **kwargs): '''Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. The ID of the certificate issuer. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): '''Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. The ID of the certificate issuer. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuers(self, **kwargs): '''Get certificate issuers list. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuers(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerInfoListResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuers_with_http_info(self, **kwargs): '''Get certificate issuers list. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuers_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerInfoListResponse If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer(self, certificate_issuer_id, certificate_issuer_update_request, **kwargs): '''Update certificate issuer. # noqa: E501 Update a certificate issuer. <br> **Example usage:** ``` curl -X PUT \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621560be51507b9d48a91b00000000 \ -d '{ "description": "Sample GlobalSign certificate issuer - updated.", "name": "GlobalSign Issuer" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer(certificate_issuer_id, certificate_issuer_update_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :param CertificateIssuerUpdateRequest certificate_issuer_update_request: Certificate issuer update request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer_with_http_info(self, certificate_issuer_id, certificate_issuer_update_request, **kwargs): '''Update certificate issuer. # noqa: E501 Update a certificate issuer. <br> **Example usage:** ``` curl -X PUT \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621560be51507b9d48a91b00000000 \ -d '{ "description": "Sample GlobalSign certificate issuer - updated.", "name": "GlobalSign Issuer" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_with_http_info(certificate_issuer_id, certificate_issuer_update_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :param CertificateIssuerUpdateRequest certificate_issuer_update_request: Certificate issuer update request. (required) :return: CertificateIssuerInfo If the method is called asynchronously, returns the request thread. ''' pass def verify_certificate_issuer(self, certificate_issuer_id, **kwargs): '''Verify certificate issuer. # noqa: E501 A utility API that can be used to validate the user configuration before activating a certificate issuer. Verifies that the certificate issuer is accessible and can be used to generate certificates by Device Management. <br> **Note:** The API requests the 3rd party CA to sign a test certificate. For some 3rd party CAs, this operation may make use of the account quota. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621a36719d507b9d48a91b00000000/verify ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.verify_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :return: CertificateIssuerVerifyResponse If the method is called asynchronously, returns the request thread. ''' pass def verify_certificate_issuer_with_http_info(self, certificate_issuer_id, **kwargs): '''Verify certificate issuer. # noqa: E501 A utility API that can be used to validate the user configuration before activating a certificate issuer. Verifies that the certificate issuer is accessible and can be used to generate certificates by Device Management. <br> **Note:** The API requests the 3rd party CA to sign a test certificate. For some 3rd party CAs, this operation may make use of the account quota. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuers/01621a36719d507b9d48a91b00000000/verify ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.verify_certificate_issuer_with_http_info(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_id: Certificate issuer ID. <br> The ID of the certificate issuer. (required) :return: CertificateIssuerVerifyResponse If the method is called asynchronously, returns the request thread. ''' pass
14
13
45
7
25
18
3
0.72
1
3
1
0
13
1
13
13
601
104
329
87
315
238
203
87
189
7
1
2
44
2,388
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/external_ca/apis/certificate_issuers_activation_api.py
mbed_cloud._backends.external_ca.apis.certificate_issuers_activation_api.CertificateIssuersActivationApi
class CertificateIssuersActivationApi(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client def create_certificate_issuer_config(self, create_certificate_issuer_config, **kwargs): # noqa: E501 """Create certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating the device custom certificates. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \\ -d '{ \"reference\": \"customer.dlms\", \"certificate_issuer_id\": \"01621a36719d507b9d48a91b00000000\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_config(create_certificate_issuer_config, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CreateCertificateIssuerConfig create_certificate_issuer_config: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.create_certificate_issuer_config_with_http_info(create_certificate_issuer_config, **kwargs) # noqa: E501 else: (data) = self.create_certificate_issuer_config_with_http_info(create_certificate_issuer_config, **kwargs) # noqa: E501 return data def create_certificate_issuer_config_with_http_info(self, create_certificate_issuer_config, **kwargs): # noqa: E501 """Create certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating the device custom certificates. <br> **Example usage:** ``` curl -X POST \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \\ -d '{ \"reference\": \"customer.dlms\", \"certificate_issuer_id\": \"01621a36719d507b9d48a91b00000000\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_config_with_http_info(create_certificate_issuer_config, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CreateCertificateIssuerConfig create_certificate_issuer_config: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ all_params = ['create_certificate_issuer_config'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_certificate_issuer_config" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'create_certificate_issuer_config' is set if ('create_certificate_issuer_config' not in params or params['create_certificate_issuer_config'] is None): raise ValueError("Missing the required parameter `create_certificate_issuer_config` when calling `create_certificate_issuer_config`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'create_certificate_issuer_config' in params: body_params = params['create_certificate_issuer_config'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def delete_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, **kwargs): # noqa: E501 """Delete certificate issuer configuration. # noqa: E501 Delete the configured certificate issuer configuration. You can only delete the configurations of custom certificates. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_config_by_id(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.delete_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, **kwargs) # noqa: E501 else: (data) = self.delete_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, **kwargs) # noqa: E501 return data def delete_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, **kwargs): # noqa: E501 """Delete certificate issuer configuration. # noqa: E501 Delete the configured certificate issuer configuration. You can only delete the configurations of custom certificates. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_configuration_id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_certificate_issuer_config_by_id" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_configuration_id' is set if ('certificate_issuer_configuration_id' not in params or params['certificate_issuer_configuration_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_configuration_id` when calling `delete_certificate_issuer_config_by_id`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_configuration_id' in params: path_params['certificate-issuer-configuration-id'] = params['certificate_issuer_configuration_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_certificate_issuer_config(self, **kwargs): # noqa: E501 """Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer to be used when creating device certificates for LwM2M communication.<br> # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_certificate_issuer_config_with_http_info(**kwargs) # noqa: E501 else: (data) = self.get_certificate_issuer_config_with_http_info(**kwargs) # noqa: E501 return data def get_certificate_issuer_config_with_http_info(self, **kwargs): # noqa: E501 """Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer to be used when creating device certificates for LwM2M communication.<br> # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ all_params = [] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_certificate_issuer_config" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations/lwm2m', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, **kwargs): # noqa: E501 """Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_by_id(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, **kwargs) # noqa: E501 else: (data) = self.get_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, **kwargs) # noqa: E501 return data def get_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, **kwargs): # noqa: E501 """Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_configuration_id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_certificate_issuer_config_by_id" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_configuration_id' is set if ('certificate_issuer_configuration_id' not in params or params['certificate_issuer_configuration_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_configuration_id` when calling `get_certificate_issuer_config_by_id`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_configuration_id' in params: path_params['certificate-issuer-configuration-id'] = params['certificate_issuer_configuration_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_certificate_issuer_configs(self, **kwargs): # noqa: E501 """Get certificate issuer configurations. # noqa: E501 Get certificate issuer configurations, optionally filtered by reference. <br> **Example usage:** ``` curl \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \\ ``` ``` curl \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations?reference__eq=dlms \\ ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_configs(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str reference__eq: The certificate name to which the certificate issuer configuration applies. :return: CertificateIssuerConfigListResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_certificate_issuer_configs_with_http_info(**kwargs) # noqa: E501 else: (data) = self.get_certificate_issuer_configs_with_http_info(**kwargs) # noqa: E501 return data def get_certificate_issuer_configs_with_http_info(self, **kwargs): # noqa: E501 """Get certificate issuer configurations. # noqa: E501 Get certificate issuer configurations, optionally filtered by reference. <br> **Example usage:** ``` curl \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \\ ``` ``` curl \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations?reference__eq=dlms \\ ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_configs_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str reference__eq: The certificate name to which the certificate issuer configuration applies. :return: CertificateIssuerConfigListResponse If the method is called asynchronously, returns the request thread. """ all_params = ['reference__eq'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_certificate_issuer_configs" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'reference__eq' in params: query_params.append(('reference__eq', params['reference__eq'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigListResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def update_certificate_issuer_config(self, certificate_issuer_config_request, **kwargs): # noqa: E501 """Update certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating device certificates for LwM2M communication. <br> **Example usage:** ``` curl -X PUT \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations/lwm2m \\ -d '{ \"certificate_issuer_id\": \"01621a36719d507b9d48a91b00000000\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config(certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate Issuer Configuration Request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.update_certificate_issuer_config_with_http_info(certificate_issuer_config_request, **kwargs) # noqa: E501 else: (data) = self.update_certificate_issuer_config_with_http_info(certificate_issuer_config_request, **kwargs) # noqa: E501 return data def update_certificate_issuer_config_with_http_info(self, certificate_issuer_config_request, **kwargs): # noqa: E501 """Update certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating device certificates for LwM2M communication. <br> **Example usage:** ``` curl -X PUT \\ -H 'authorization: <valid access token>' \\ -H 'content-type: application/json;charset=UTF-8' \\ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations/lwm2m \\ -d '{ \"certificate_issuer_id\": \"01621a36719d507b9d48a91b00000000\" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_with_http_info(certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate Issuer Configuration Request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_config_request'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method update_certificate_issuer_config" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_config_request' is set if ('certificate_issuer_config_request' not in params or params['certificate_issuer_config_request'] is None): raise ValueError("Missing the required parameter `certificate_issuer_config_request` when calling `update_certificate_issuer_config`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'certificate_issuer_config_request' in params: body_params = params['certificate_issuer_config_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations/lwm2m', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def update_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs): # noqa: E501 """Update certificate issuer configuration. # noqa: E501 Update the configured certificate issuer configuration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_by_id(certificate_issuer_configuration_id, certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.update_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs) # noqa: E501 else: (data) = self.update_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs) # noqa: E501 return data def update_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs): # noqa: E501 """Update certificate issuer configuration. # noqa: E501 Update the configured certificate issuer configuration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. """ all_params = ['certificate_issuer_configuration_id', 'certificate_issuer_config_request'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method update_certificate_issuer_config_by_id" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'certificate_issuer_configuration_id' is set if ('certificate_issuer_configuration_id' not in params or params['certificate_issuer_configuration_id'] is None): raise ValueError("Missing the required parameter `certificate_issuer_configuration_id` when calling `update_certificate_issuer_config_by_id`") # noqa: E501 # verify the required parameter 'certificate_issuer_config_request' is set if ('certificate_issuer_config_request' not in params or params['certificate_issuer_config_request'] is None): raise ValueError("Missing the required parameter `certificate_issuer_config_request` when calling `update_certificate_issuer_config_by_id`") # noqa: E501 collection_formats = {} path_params = {} if 'certificate_issuer_configuration_id' in params: path_params['certificate-issuer-configuration-id'] = params['certificate_issuer_configuration_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'certificate_issuer_config_request' in params: body_params = params['certificate_issuer_config_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json; charset=utf-8']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json; charset=utf-8']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/certificate-issuer-configurations/{certificate-issuer-configuration-id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CertificateIssuerConfigResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
class CertificateIssuersActivationApi(object): '''NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen ''' def __init__(self, api_client=None): pass def create_certificate_issuer_config(self, create_certificate_issuer_config, **kwargs): '''Create certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating the device custom certificates. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \ -d '{ "reference": "customer.dlms", "certificate_issuer_id": "01621a36719d507b9d48a91b00000000" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_config(create_certificate_issuer_config, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CreateCertificateIssuerConfig create_certificate_issuer_config: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def create_certificate_issuer_config_with_http_info(self, create_certificate_issuer_config, **kwargs): '''Create certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating the device custom certificates. <br> **Example usage:** ``` curl -X POST \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \ -d '{ "reference": "customer.dlms", "certificate_issuer_id": "01621a36719d507b9d48a91b00000000" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_certificate_issuer_config_with_http_info(create_certificate_issuer_config, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CreateCertificateIssuerConfig create_certificate_issuer_config: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def delete_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, **kwargs): '''Delete certificate issuer configuration. # noqa: E501 Delete the configured certificate issuer configuration. You can only delete the configurations of custom certificates. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_config_by_id(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def delete_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, **kwargs): '''Delete certificate issuer configuration. # noqa: E501 Delete the configured certificate issuer configuration. You can only delete the configurations of custom certificates. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_config(self, **kwargs): '''Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer to be used when creating device certificates for LwM2M communication.<br> # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_config_with_http_info(self, **kwargs): '''Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer to be used when creating device certificates for LwM2M communication.<br> # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, **kwargs): '''Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_by_id(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, **kwargs): '''Get certificate issuer configuration. # noqa: E501 Provides the configured certificate issuer. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_configs(self, **kwargs): '''Get certificate issuer configurations. # noqa: E501 Get certificate issuer configurations, optionally filtered by reference. <br> **Example usage:** ``` curl \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \ ``` ``` curl \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations?reference__eq=dlms \ ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_configs(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str reference__eq: The certificate name to which the certificate issuer configuration applies. :return: CertificateIssuerConfigListResponse If the method is called asynchronously, returns the request thread. ''' pass def get_certificate_issuer_configs_with_http_info(self, **kwargs): '''Get certificate issuer configurations. # noqa: E501 Get certificate issuer configurations, optionally filtered by reference. <br> **Example usage:** ``` curl \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations \ ``` ``` curl \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations?reference__eq=dlms \ ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer_configs_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str reference__eq: The certificate name to which the certificate issuer configuration applies. :return: CertificateIssuerConfigListResponse If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer_config(self, certificate_issuer_config_request, **kwargs): '''Update certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating device certificates for LwM2M communication. <br> **Example usage:** ``` curl -X PUT \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations/lwm2m \ -d '{ "certificate_issuer_id": "01621a36719d507b9d48a91b00000000" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config(certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate Issuer Configuration Request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer_config_with_http_info(self, certificate_issuer_config_request, **kwargs): '''Update certificate issuer configuration. # noqa: E501 Configure the certificate issuer to be used when creating device certificates for LwM2M communication. <br> **Example usage:** ``` curl -X PUT \ -H 'authorization: <valid access token>' \ -H 'content-type: application/json;charset=UTF-8' \ https://api.us-east-1.mbedcloud.com/v3/certificate-issuer-configurations/lwm2m \ -d '{ "certificate_issuer_id": "01621a36719d507b9d48a91b00000000" }' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_with_http_info(certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate Issuer Configuration Request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer_config_by_id(self, certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs): '''Update certificate issuer configuration. # noqa: E501 Update the configured certificate issuer configuration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_by_id(certificate_issuer_configuration_id, certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass def update_certificate_issuer_config_by_id_with_http_info(self, certificate_issuer_configuration_id, certificate_issuer_config_request, **kwargs): '''Update certificate issuer configuration. # noqa: E501 Update the configured certificate issuer configuration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.update_certificate_issuer_config_by_id_with_http_info(certificate_issuer_configuration_id, certificate_issuer_config_request, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str certificate_issuer_configuration_id: The ID of the certificate issuer configuration. (required) :param CertificateIssuerConfigRequest certificate_issuer_config_request: Certificate issuer configuration request (required) :return: CertificateIssuerConfigResponse If the method is called asynchronously, returns the request thread. ''' pass
16
15
45
7
25
18
3
0.73
1
3
1
0
15
1
15
15
700
121
380
101
364
279
234
101
218
7
1
2
50
2,389
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/field.py
mbed_cloud._backends.enrollment.models.field.Field
class Field(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'message': 'str', 'name': 'str' } attribute_map = { 'message': 'message', 'name': 'name' } def __init__(self, message=None, name=None): """ Field - a model defined in Swagger """ self._message = message self._name = name self.discriminator = None @property def message(self): """ Gets the message of this Field. A message describing the error situation. :return: The message of this Field. :rtype: str """ return self._message @message.setter def message(self, message): """ Sets the message of this Field. A message describing the error situation. :param message: The message of this Field. :type: str """ self._message = message @property def name(self): """ Gets the name of this Field. The name of the erroneous field. :return: The name of this Field. :rtype: str """ return self._name @name.setter def name(self, name): """ Sets the name of this Field. The name of the erroneous field. :param name: The name of this Field. :type: str """ self._name = name def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, Field): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class Field(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, message=None, name=None): ''' Field - a model defined in Swagger ''' pass @property def message(self): ''' Gets the message of this Field. A message describing the error situation. :return: The message of this Field. :rtype: str ''' pass @message.setter def message(self): ''' Sets the message of this Field. A message describing the error situation. :param message: The message of this Field. :type: str ''' pass @property def name(self): ''' Gets the name of this Field. The name of the erroneous field. :return: The name of this Field. :rtype: str ''' pass @name.setter def name(self): ''' Sets the name of this Field. The name of the erroneous field. :param name: The name of this Field. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
15
11
9
1
4
4
2
0.96
1
3
0
0
10
3
10
10
131
23
55
23
40
53
35
19
24
5
1
2
15
2,390
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/error_response.py
mbed_cloud._backends.enrollment.models.error_response.ErrorResponse
class ErrorResponse(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'code': 'int', 'fields': 'list[Field]', 'message': 'str', 'object': 'str', 'request_id': 'str', 'type': 'str' } attribute_map = { 'code': 'code', 'fields': 'fields', 'message': 'message', 'object': 'object', 'request_id': 'request_id', 'type': 'type' } def __init__(self, code=None, fields=None, message=None, object='error', request_id=None, type=None): """ ErrorResponse - a model defined in Swagger """ self._code = code self._fields = fields self._message = message self._object = object self._request_id = request_id self._type = type self.discriminator = None @property def code(self): """ Gets the code of this ErrorResponse. Response code. :return: The code of this ErrorResponse. :rtype: int """ return self._code @code.setter def code(self, code): """ Sets the code of this ErrorResponse. Response code. :param code: The code of this ErrorResponse. :type: int """ allowed_values = [400, 401, 404] if code not in allowed_values: raise ValueError( "Invalid value for `code` ({0}), must be one of {1}" .format(code, allowed_values) ) self._code = code @property def fields(self): """ Gets the fields of this ErrorResponse. Failed input fields during request object validation. :return: The fields of this ErrorResponse. :rtype: list[Field] """ return self._fields @fields.setter def fields(self, fields): """ Sets the fields of this ErrorResponse. Failed input fields during request object validation. :param fields: The fields of this ErrorResponse. :type: list[Field] """ self._fields = fields @property def message(self): """ Gets the message of this ErrorResponse. A human readable message with detailed info. :return: The message of this ErrorResponse. :rtype: str """ return self._message @message.setter def message(self, message): """ Sets the message of this ErrorResponse. A human readable message with detailed info. :param message: The message of this ErrorResponse. :type: str """ self._message = message @property def object(self): """ Gets the object of this ErrorResponse. Entity name, always 'error'. :return: The object of this ErrorResponse. :rtype: str """ return self._object @object.setter def object(self, object): """ Sets the object of this ErrorResponse. Entity name, always 'error'. :param object: The object of this ErrorResponse. :type: str """ allowed_values = ["error"] if object not in allowed_values: raise ValueError( "Invalid value for `object` ({0}), must be one of {1}" .format(object, allowed_values) ) self._object = object @property def request_id(self): """ Gets the request_id of this ErrorResponse. Request ID. :return: The request_id of this ErrorResponse. :rtype: str """ return self._request_id @request_id.setter def request_id(self, request_id): """ Sets the request_id of this ErrorResponse. Request ID. :param request_id: The request_id of this ErrorResponse. :type: str """ if request_id is not None and not re.search('^[A-Za-z0-9]{32}', request_id): raise ValueError("Invalid value for `request_id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._request_id = request_id @property def type(self): """ Gets the type of this ErrorResponse. Error type. :return: The type of this ErrorResponse. :rtype: str """ return self._type @type.setter def type(self, type): """ Sets the type of this ErrorResponse. Error type. :param type: The type of this ErrorResponse. :type: str """ allowed_values = ["validation_error", "invalid_token", "invalid_apikey", "reauth_required", "access_denied", "account_limit_exceeded", "not_found", "method_not_supported", "not_acceptable", "duplicate", "precondition_failed", "unsupported_media_type", "rate_limit_exceeded", "internal_server_error", "system_unavailable"] if type not in allowed_values: raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" .format(type, allowed_values) ) self._type = type def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, ErrorResponse): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class ErrorResponse(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, code=None, fields=None, message=None, object='error', request_id=None, type=None): ''' ErrorResponse - a model defined in Swagger ''' pass @property def code(self): ''' Gets the code of this ErrorResponse. Response code. :return: The code of this ErrorResponse. :rtype: int ''' pass @code.setter def code(self): ''' Sets the code of this ErrorResponse. Response code. :param code: The code of this ErrorResponse. :type: int ''' pass @property def fields(self): ''' Gets the fields of this ErrorResponse. Failed input fields during request object validation. :return: The fields of this ErrorResponse. :rtype: list[Field] ''' pass @fields.setter def fields(self): ''' Sets the fields of this ErrorResponse. Failed input fields during request object validation. :param fields: The fields of this ErrorResponse. :type: list[Field] ''' pass @property def message(self): ''' Gets the message of this ErrorResponse. A human readable message with detailed info. :return: The message of this ErrorResponse. :rtype: str ''' pass @message.setter def message(self): ''' Sets the message of this ErrorResponse. A human readable message with detailed info. :param message: The message of this ErrorResponse. :type: str ''' pass @property def object(self): ''' Gets the object of this ErrorResponse. Entity name, always 'error'. :return: The object of this ErrorResponse. :rtype: str ''' pass @object.setter def object(self): ''' Sets the object of this ErrorResponse. Entity name, always 'error'. :param object: The object of this ErrorResponse. :type: str ''' pass @property def request_id(self): ''' Gets the request_id of this ErrorResponse. Request ID. :return: The request_id of this ErrorResponse. :rtype: str ''' pass @request_id.setter def request_id(self): ''' Sets the request_id of this ErrorResponse. Request ID. :param request_id: The request_id of this ErrorResponse. :type: str ''' pass @property def type(self): ''' Gets the type of this ErrorResponse. Error type. :return: The type of this ErrorResponse. :rtype: str ''' pass @type.setter def type(self): ''' Sets the type of this ErrorResponse. Error type. :param type: The type of this ErrorResponse. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
31
19
11
1
5
5
2
0.91
1
4
0
0
18
7
18
18
255
43
111
46
80
101
66
34
47
5
1
2
27
2,391
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/enrollment_identity.py
mbed_cloud._backends.enrollment.models.enrollment_identity.EnrollmentIdentity
class EnrollmentIdentity(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'account_id': 'str', 'claimed_at': 'datetime', 'created_at': 'datetime', 'enrolled_device_id': 'str', 'enrollment_identity': 'str', 'etag': 'str', 'expires_at': 'datetime', 'id': 'str', 'object': 'str' } attribute_map = { 'account_id': 'account_id', 'claimed_at': 'claimed_at', 'created_at': 'created_at', 'enrolled_device_id': 'enrolled_device_id', 'enrollment_identity': 'enrollment_identity', 'etag': 'etag', 'expires_at': 'expires_at', 'id': 'id', 'object': 'object' } def __init__(self, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, etag=None, expires_at=None, id=None, object=None): """ EnrollmentIdentity - a model defined in Swagger """ self._account_id = account_id self._claimed_at = claimed_at self._created_at = created_at self._enrolled_device_id = enrolled_device_id self._enrollment_identity = enrollment_identity self._etag = etag self._expires_at = expires_at self._id = id self._object = object self.discriminator = None @property def account_id(self): """ Gets the account_id of this EnrollmentIdentity. ID :return: The account_id of this EnrollmentIdentity. :rtype: str """ return self._account_id @account_id.setter def account_id(self, account_id): """ Sets the account_id of this EnrollmentIdentity. ID :param account_id: The account_id of this EnrollmentIdentity. :type: str """ if account_id is None: raise ValueError("Invalid value for `account_id`, must not be `None`") self._account_id = account_id @property def claimed_at(self): """ Gets the claimed_at of this EnrollmentIdentity. The time of claiming the device to be assigned to the account. :return: The claimed_at of this EnrollmentIdentity. :rtype: datetime """ return self._claimed_at @claimed_at.setter def claimed_at(self, claimed_at): """ Sets the claimed_at of this EnrollmentIdentity. The time of claiming the device to be assigned to the account. :param claimed_at: The claimed_at of this EnrollmentIdentity. :type: datetime """ if claimed_at is None: raise ValueError("Invalid value for `claimed_at`, must not be `None`") self._claimed_at = claimed_at @property def created_at(self): """ Gets the created_at of this EnrollmentIdentity. The time of the enrollment identity creation. :return: The created_at of this EnrollmentIdentity. :rtype: datetime """ return self._created_at @created_at.setter def created_at(self, created_at): """ Sets the created_at of this EnrollmentIdentity. The time of the enrollment identity creation. :param created_at: The created_at of this EnrollmentIdentity. :type: datetime """ if created_at is None: raise ValueError("Invalid value for `created_at`, must not be `None`") self._created_at = created_at @property def enrolled_device_id(self): """ Gets the enrolled_device_id of this EnrollmentIdentity. The ID of the device in the Device Directory once it has been registered. :return: The enrolled_device_id of this EnrollmentIdentity. :rtype: str """ return self._enrolled_device_id @enrolled_device_id.setter def enrolled_device_id(self, enrolled_device_id): """ Sets the enrolled_device_id of this EnrollmentIdentity. The ID of the device in the Device Directory once it has been registered. :param enrolled_device_id: The enrolled_device_id of this EnrollmentIdentity. :type: str """ if enrolled_device_id is None: raise ValueError("Invalid value for `enrolled_device_id`, must not be `None`") if enrolled_device_id is not None and not re.search('^[A-Za-z0-9]{32}', enrolled_device_id): raise ValueError("Invalid value for `enrolled_device_id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._enrolled_device_id = enrolled_device_id @property def enrollment_identity(self): """ Gets the enrollment_identity of this EnrollmentIdentity. Enrollment identity. :return: The enrollment_identity of this EnrollmentIdentity. :rtype: str """ return self._enrollment_identity @enrollment_identity.setter def enrollment_identity(self, enrollment_identity): """ Sets the enrollment_identity of this EnrollmentIdentity. Enrollment identity. :param enrollment_identity: The enrollment_identity of this EnrollmentIdentity. :type: str """ if enrollment_identity is None: raise ValueError("Invalid value for `enrollment_identity`, must not be `None`") if enrollment_identity is not None and not re.search('^A-[A-Za-z0-9:]{95}$', enrollment_identity): raise ValueError("Invalid value for `enrollment_identity`, must be a follow pattern or equal to `/^A-[A-Za-z0-9:]{95}$/`") self._enrollment_identity = enrollment_identity @property def etag(self): """ Gets the etag of this EnrollmentIdentity. :return: The etag of this EnrollmentIdentity. :rtype: str """ return self._etag @etag.setter def etag(self, etag): """ Sets the etag of this EnrollmentIdentity. :param etag: The etag of this EnrollmentIdentity. :type: str """ if etag is None: raise ValueError("Invalid value for `etag`, must not be `None`") if etag is not None and not re.search('[A-Za-z0-9]{1,256}', etag): raise ValueError("Invalid value for `etag`, must be a follow pattern or equal to `/[A-Za-z0-9]{1,256}/`") self._etag = etag @property def expires_at(self): """ Gets the expires_at of this EnrollmentIdentity. The enrollment claim expiration time. If the device does not connect to Mbed Cloud before the expiration, the claim is removed without a separate notice :return: The expires_at of this EnrollmentIdentity. :rtype: datetime """ return self._expires_at @expires_at.setter def expires_at(self, expires_at): """ Sets the expires_at of this EnrollmentIdentity. The enrollment claim expiration time. If the device does not connect to Mbed Cloud before the expiration, the claim is removed without a separate notice :param expires_at: The expires_at of this EnrollmentIdentity. :type: datetime """ if expires_at is None: raise ValueError("Invalid value for `expires_at`, must not be `None`") self._expires_at = expires_at @property def id(self): """ Gets the id of this EnrollmentIdentity. Enrollment identity. :return: The id of this EnrollmentIdentity. :rtype: str """ return self._id @id.setter def id(self, id): """ Sets the id of this EnrollmentIdentity. Enrollment identity. :param id: The id of this EnrollmentIdentity. :type: str """ if id is None: raise ValueError("Invalid value for `id`, must not be `None`") if id is not None and not re.search('^[A-Za-z0-9]{32}', id): raise ValueError("Invalid value for `id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._id = id @property def object(self): """ Gets the object of this EnrollmentIdentity. :return: The object of this EnrollmentIdentity. :rtype: str """ return self._object @object.setter def object(self, object): """ Sets the object of this EnrollmentIdentity. :param object: The object of this EnrollmentIdentity. :type: str """ if object is None: raise ValueError("Invalid value for `object`, must not be `None`") allowed_values = ["enrollment"] if object not in allowed_values: raise ValueError( "Invalid value for `object` ({0}), must be one of {1}" .format(object, allowed_values) ) self._object = object def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, EnrollmentIdentity): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class EnrollmentIdentity(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, account_id=None, claimed_at=None, created_at=None, enrolled_device_id=None, enrollment_identity=None, etag=None, expires_at=None, id=None, object=None): ''' EnrollmentIdentity - a model defined in Swagger ''' pass @property def account_id(self): ''' Gets the account_id of this EnrollmentIdentity. ID :return: The account_id of this EnrollmentIdentity. :rtype: str ''' pass @account_id.setter def account_id(self): ''' Sets the account_id of this EnrollmentIdentity. ID :param account_id: The account_id of this EnrollmentIdentity. :type: str ''' pass @property def claimed_at(self): ''' Gets the claimed_at of this EnrollmentIdentity. The time of claiming the device to be assigned to the account. :return: The claimed_at of this EnrollmentIdentity. :rtype: datetime ''' pass @claimed_at.setter def claimed_at(self): ''' Sets the claimed_at of this EnrollmentIdentity. The time of claiming the device to be assigned to the account. :param claimed_at: The claimed_at of this EnrollmentIdentity. :type: datetime ''' pass @property def created_at(self): ''' Gets the created_at of this EnrollmentIdentity. The time of the enrollment identity creation. :return: The created_at of this EnrollmentIdentity. :rtype: datetime ''' pass @created_at.setter def created_at(self): ''' Sets the created_at of this EnrollmentIdentity. The time of the enrollment identity creation. :param created_at: The created_at of this EnrollmentIdentity. :type: datetime ''' pass @property def enrolled_device_id(self): ''' Gets the enrolled_device_id of this EnrollmentIdentity. The ID of the device in the Device Directory once it has been registered. :return: The enrolled_device_id of this EnrollmentIdentity. :rtype: str ''' pass @enrolled_device_id.setter def enrolled_device_id(self): ''' Sets the enrolled_device_id of this EnrollmentIdentity. The ID of the device in the Device Directory once it has been registered. :param enrolled_device_id: The enrolled_device_id of this EnrollmentIdentity. :type: str ''' pass @property def enrollment_identity(self): ''' Gets the enrollment_identity of this EnrollmentIdentity. Enrollment identity. :return: The enrollment_identity of this EnrollmentIdentity. :rtype: str ''' pass @enrollment_identity.setter def enrollment_identity(self): ''' Sets the enrollment_identity of this EnrollmentIdentity. Enrollment identity. :param enrollment_identity: The enrollment_identity of this EnrollmentIdentity. :type: str ''' pass @property def etag(self): ''' Gets the etag of this EnrollmentIdentity. :return: The etag of this EnrollmentIdentity. :rtype: str ''' pass @etag.setter def etag(self): ''' Sets the etag of this EnrollmentIdentity. :param etag: The etag of this EnrollmentIdentity. :type: str ''' pass @property def expires_at(self): ''' Gets the expires_at of this EnrollmentIdentity. The enrollment claim expiration time. If the device does not connect to Mbed Cloud before the expiration, the claim is removed without a separate notice :return: The expires_at of this EnrollmentIdentity. :rtype: datetime ''' pass @expires_at.setter def expires_at(self): ''' Sets the expires_at of this EnrollmentIdentity. The enrollment claim expiration time. If the device does not connect to Mbed Cloud before the expiration, the claim is removed without a separate notice :param expires_at: The expires_at of this EnrollmentIdentity. :type: datetime ''' pass @property def id(self): ''' Gets the id of this EnrollmentIdentity. Enrollment identity. :return: The id of this EnrollmentIdentity. :rtype: str ''' pass @id.setter def id(self): ''' Sets the id of this EnrollmentIdentity. Enrollment identity. :param id: The id of this EnrollmentIdentity. :type: str ''' pass @property def object(self): ''' Gets the object of this EnrollmentIdentity. :return: The object of this EnrollmentIdentity. :rtype: str ''' pass @object.setter def object(self): ''' Sets the object of this EnrollmentIdentity. :param object: The object of this EnrollmentIdentity. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
43
25
11
1
5
5
2
0.89
1
4
0
0
24
10
24
24
341
58
150
59
107
133
99
41
74
5
1
2
43
2,392
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/enrollment_identities.py
mbed_cloud._backends.enrollment.models.enrollment_identities.EnrollmentIdentities
class EnrollmentIdentities(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'after': 'str', 'data': 'list[EnrollmentIdentity]', 'has_more': 'bool', 'limit': 'int', 'object': 'str', 'order': 'str', 'total_count': 'int' } attribute_map = { 'after': 'after', 'data': 'data', 'has_more': 'has_more', 'limit': 'limit', 'object': 'object', 'order': 'order', 'total_count': 'total_count' } def __init__(self, after=None, data=None, has_more=None, limit=None, object=None, order='ASC', total_count=None): """ EnrollmentIdentities - a model defined in Swagger """ self._after = after self._data = data self._has_more = has_more self._limit = limit self._object = object self._order = order self._total_count = total_count self.discriminator = None @property def after(self): """ Gets the after of this EnrollmentIdentities. ID :return: The after of this EnrollmentIdentities. :rtype: str """ return self._after @after.setter def after(self, after): """ Sets the after of this EnrollmentIdentities. ID :param after: The after of this EnrollmentIdentities. :type: str """ if after is None: raise ValueError("Invalid value for `after`, must not be `None`") if after is not None and not re.search('^[A-Za-z0-9]{32}', after): raise ValueError("Invalid value for `after`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._after = after @property def data(self): """ Gets the data of this EnrollmentIdentities. :return: The data of this EnrollmentIdentities. :rtype: list[EnrollmentIdentity] """ return self._data @data.setter def data(self, data): """ Sets the data of this EnrollmentIdentities. :param data: The data of this EnrollmentIdentities. :type: list[EnrollmentIdentity] """ if data is None: raise ValueError("Invalid value for `data`, must not be `None`") self._data = data @property def has_more(self): """ Gets the has_more of this EnrollmentIdentities. :return: The has_more of this EnrollmentIdentities. :rtype: bool """ return self._has_more @has_more.setter def has_more(self, has_more): """ Sets the has_more of this EnrollmentIdentities. :param has_more: The has_more of this EnrollmentIdentities. :type: bool """ if has_more is None: raise ValueError("Invalid value for `has_more`, must not be `None`") self._has_more = has_more @property def limit(self): """ Gets the limit of this EnrollmentIdentities. Range 2-1000, or default. :return: The limit of this EnrollmentIdentities. :rtype: int """ return self._limit @limit.setter def limit(self, limit): """ Sets the limit of this EnrollmentIdentities. Range 2-1000, or default. :param limit: The limit of this EnrollmentIdentities. :type: int """ if limit is None: raise ValueError("Invalid value for `limit`, must not be `None`") if limit is not None and limit > 1000: raise ValueError("Invalid value for `limit`, must be a value less than or equal to `1000`") if limit is not None and limit < 2: raise ValueError("Invalid value for `limit`, must be a value greater than or equal to `2`") self._limit = limit @property def object(self): """ Gets the object of this EnrollmentIdentities. :return: The object of this EnrollmentIdentities. :rtype: str """ return self._object @object.setter def object(self, object): """ Sets the object of this EnrollmentIdentities. :param object: The object of this EnrollmentIdentities. :type: str """ if object is None: raise ValueError("Invalid value for `object`, must not be `None`") allowed_values = ["list"] if object not in allowed_values: raise ValueError( "Invalid value for `object` ({0}), must be one of {1}" .format(object, allowed_values) ) self._object = object @property def order(self): """ Gets the order of this EnrollmentIdentities. :return: The order of this EnrollmentIdentities. :rtype: str """ return self._order @order.setter def order(self, order): """ Sets the order of this EnrollmentIdentities. :param order: The order of this EnrollmentIdentities. :type: str """ if order is None: raise ValueError("Invalid value for `order`, must not be `None`") allowed_values = ["ASC", "DESC"] if order not in allowed_values: raise ValueError( "Invalid value for `order` ({0}), must be one of {1}" .format(order, allowed_values) ) self._order = order @property def total_count(self): """ Gets the total_count of this EnrollmentIdentities. :return: The total_count of this EnrollmentIdentities. :rtype: int """ return self._total_count @total_count.setter def total_count(self, total_count): """ Sets the total_count of this EnrollmentIdentities. :param total_count: The total_count of this EnrollmentIdentities. :type: int """ if total_count is None: raise ValueError("Invalid value for `total_count`, must not be `None`") if total_count is not None and total_count < 1: raise ValueError("Invalid value for `total_count`, must be a value greater than or equal to `1`") self._total_count = total_count def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, EnrollmentIdentities): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class EnrollmentIdentities(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, after=None, data=None, has_more=None, limit=None, object=None, order='ASC', total_count=None): ''' EnrollmentIdentities - a model defined in Swagger ''' pass @property def after(self): ''' Gets the after of this EnrollmentIdentities. ID :return: The after of this EnrollmentIdentities. :rtype: str ''' pass @after.setter def after(self): ''' Sets the after of this EnrollmentIdentities. ID :param after: The after of this EnrollmentIdentities. :type: str ''' pass @property def data(self): ''' Gets the data of this EnrollmentIdentities. :return: The data of this EnrollmentIdentities. :rtype: list[EnrollmentIdentity] ''' pass @data.setter def data(self): ''' Sets the data of this EnrollmentIdentities. :param data: The data of this EnrollmentIdentities. :type: list[EnrollmentIdentity] ''' pass @property def has_more(self): ''' Gets the has_more of this EnrollmentIdentities. :return: The has_more of this EnrollmentIdentities. :rtype: bool ''' pass @has_more.setter def has_more(self): ''' Sets the has_more of this EnrollmentIdentities. :param has_more: The has_more of this EnrollmentIdentities. :type: bool ''' pass @property def limit(self): ''' Gets the limit of this EnrollmentIdentities. Range 2-1000, or default. :return: The limit of this EnrollmentIdentities. :rtype: int ''' pass @limit.setter def limit(self): ''' Sets the limit of this EnrollmentIdentities. Range 2-1000, or default. :param limit: The limit of this EnrollmentIdentities. :type: int ''' pass @property def object(self): ''' Gets the object of this EnrollmentIdentities. :return: The object of this EnrollmentIdentities. :rtype: str ''' pass @object.setter def object(self): ''' Sets the object of this EnrollmentIdentities. :param object: The object of this EnrollmentIdentities. :type: str ''' pass @property def order(self): ''' Gets the order of this EnrollmentIdentities. :return: The order of this EnrollmentIdentities. :rtype: str ''' pass @order.setter def order(self): ''' Sets the order of this EnrollmentIdentities. :param order: The order of this EnrollmentIdentities. :type: str ''' pass @property def total_count(self): ''' Gets the total_count of this EnrollmentIdentities. :return: The total_count of this EnrollmentIdentities. :rtype: int ''' pass @total_count.setter def total_count(self): ''' Sets the total_count of this EnrollmentIdentities. :param total_count: The total_count of this EnrollmentIdentities. :type: int ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
35
21
11
1
5
5
2
0.77
1
4
0
0
20
8
20
20
285
48
134
50
99
103
88
36
67
5
1
2
38
2,393
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/enrollment_id.py
mbed_cloud._backends.enrollment.models.enrollment_id.EnrollmentId
class EnrollmentId(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'enrollment_identity': 'str' } attribute_map = { 'enrollment_identity': 'enrollment_identity' } def __init__(self, enrollment_identity=None): """ EnrollmentId - a model defined in Swagger """ self._enrollment_identity = enrollment_identity self.discriminator = None @property def enrollment_identity(self): """ Gets the enrollment_identity of this EnrollmentId. Enrollment identity. :return: The enrollment_identity of this EnrollmentId. :rtype: str """ return self._enrollment_identity @enrollment_identity.setter def enrollment_identity(self, enrollment_identity): """ Sets the enrollment_identity of this EnrollmentId. Enrollment identity. :param enrollment_identity: The enrollment_identity of this EnrollmentId. :type: str """ if enrollment_identity is None: raise ValueError("Invalid value for `enrollment_identity`, must not be `None`") if enrollment_identity is not None and not re.search('^A-[A-Za-z0-9:]{95}$', enrollment_identity): raise ValueError("Invalid value for `enrollment_identity`, must be a follow pattern or equal to `/^A-[A-Za-z0-9:]{95}$/`") self._enrollment_identity = enrollment_identity def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, EnrollmentId): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class EnrollmentId(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, enrollment_identity=None): ''' EnrollmentId - a model defined in Swagger ''' pass @property def enrollment_identity(self): ''' Gets the enrollment_identity of this EnrollmentId. Enrollment identity. :return: The enrollment_identity of this EnrollmentId. :rtype: str ''' pass @enrollment_identity.setter def enrollment_identity(self): ''' Sets the enrollment_identity of this EnrollmentId. Enrollment identity. :param enrollment_identity: The enrollment_identity of this EnrollmentId. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
11
9
10
1
5
4
2
0.82
1
4
0
0
8
2
8
8
109
18
50
18
39
41
34
16
25
5
1
2
15
2,394
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/bulk_response.py
mbed_cloud._backends.enrollment.models.bulk_response.BulkResponse
class BulkResponse(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'account_id': 'str', 'completed_at': 'datetime', 'created_at': 'datetime', 'errors_count': 'int', 'errors_report_file': 'str', 'etag': 'str', 'full_report_file': 'str', 'id': 'str', 'object': 'str', 'processed_count': 'int', 'status': 'str', 'total_count': 'int' } attribute_map = { 'account_id': 'account_id', 'completed_at': 'completed_at', 'created_at': 'created_at', 'errors_count': 'errors_count', 'errors_report_file': 'errors_report_file', 'etag': 'etag', 'full_report_file': 'full_report_file', 'id': 'id', 'object': 'object', 'processed_count': 'processed_count', 'status': 'status', 'total_count': 'total_count' } def __init__(self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, etag=None, full_report_file=None, id=None, object=None, processed_count=None, status='new', total_count=None): """ BulkResponse - a model defined in Swagger """ self._account_id = account_id self._completed_at = completed_at self._created_at = created_at self._errors_count = errors_count self._errors_report_file = errors_report_file self._etag = etag self._full_report_file = full_report_file self._id = id self._object = object self._processed_count = processed_count self._status = status self._total_count = total_count self.discriminator = None @property def account_id(self): """ Gets the account_id of this BulkResponse. ID :return: The account_id of this BulkResponse. :rtype: str """ return self._account_id @account_id.setter def account_id(self, account_id): """ Sets the account_id of this BulkResponse. ID :param account_id: The account_id of this BulkResponse. :type: str """ if account_id is None: raise ValueError("Invalid value for `account_id`, must not be `None`") self._account_id = account_id @property def completed_at(self): """ Gets the completed_at of this BulkResponse. The time of completing the bulk creation task. :return: The completed_at of this BulkResponse. :rtype: datetime """ return self._completed_at @completed_at.setter def completed_at(self, completed_at): """ Sets the completed_at of this BulkResponse. The time of completing the bulk creation task. :param completed_at: The completed_at of this BulkResponse. :type: datetime """ self._completed_at = completed_at @property def created_at(self): """ Gets the created_at of this BulkResponse. The time of receiving the bulk creation task. :return: The created_at of this BulkResponse. :rtype: datetime """ return self._created_at @created_at.setter def created_at(self, created_at): """ Sets the created_at of this BulkResponse. The time of receiving the bulk creation task. :param created_at: The created_at of this BulkResponse. :type: datetime """ if created_at is None: raise ValueError("Invalid value for `created_at`, must not be `None`") self._created_at = created_at @property def errors_count(self): """ Gets the errors_count of this BulkResponse. The number of enrollment identities with failed processing. :return: The errors_count of this BulkResponse. :rtype: int """ return self._errors_count @errors_count.setter def errors_count(self, errors_count): """ Sets the errors_count of this BulkResponse. The number of enrollment identities with failed processing. :param errors_count: The errors_count of this BulkResponse. :type: int """ if errors_count is None: raise ValueError("Invalid value for `errors_count`, must not be `None`") self._errors_count = errors_count @property def errors_report_file(self): """ Gets the errors_report_file of this BulkResponse. :return: The errors_report_file of this BulkResponse. :rtype: str """ return self._errors_report_file @errors_report_file.setter def errors_report_file(self, errors_report_file): """ Sets the errors_report_file of this BulkResponse. :param errors_report_file: The errors_report_file of this BulkResponse. :type: str """ self._errors_report_file = errors_report_file @property def etag(self): """ Gets the etag of this BulkResponse. etag :return: The etag of this BulkResponse. :rtype: str """ return self._etag @etag.setter def etag(self, etag): """ Sets the etag of this BulkResponse. etag :param etag: The etag of this BulkResponse. :type: str """ if etag is None: raise ValueError("Invalid value for `etag`, must not be `None`") if etag is not None and not re.search('[A-Za-z0-9]{0,256}', etag): raise ValueError("Invalid value for `etag`, must be a follow pattern or equal to `/[A-Za-z0-9]{0,256}/`") self._etag = etag @property def full_report_file(self): """ Gets the full_report_file of this BulkResponse. :return: The full_report_file of this BulkResponse. :rtype: str """ return self._full_report_file @full_report_file.setter def full_report_file(self, full_report_file): """ Sets the full_report_file of this BulkResponse. :param full_report_file: The full_report_file of this BulkResponse. :type: str """ self._full_report_file = full_report_file @property def id(self): """ Gets the id of this BulkResponse. Bulk ID :return: The id of this BulkResponse. :rtype: str """ return self._id @id.setter def id(self, id): """ Sets the id of this BulkResponse. Bulk ID :param id: The id of this BulkResponse. :type: str """ if id is None: raise ValueError("Invalid value for `id`, must not be `None`") if id is not None and not re.search('^[A-Za-z0-9]{32}', id): raise ValueError("Invalid value for `id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._id = id @property def object(self): """ Gets the object of this BulkResponse. :return: The object of this BulkResponse. :rtype: str """ return self._object @object.setter def object(self, object): """ Sets the object of this BulkResponse. :param object: The object of this BulkResponse. :type: str """ if object is None: raise ValueError("Invalid value for `object`, must not be `None`") allowed_values = ["enrollment-identity-bulk-uploads"] if object not in allowed_values: raise ValueError( "Invalid value for `object` ({0}), must be one of {1}" .format(object, allowed_values) ) self._object = object @property def processed_count(self): """ Gets the processed_count of this BulkResponse. The number of enrollment identities processed until now. :return: The processed_count of this BulkResponse. :rtype: int """ return self._processed_count @processed_count.setter def processed_count(self, processed_count): """ Sets the processed_count of this BulkResponse. The number of enrollment identities processed until now. :param processed_count: The processed_count of this BulkResponse. :type: int """ if processed_count is None: raise ValueError("Invalid value for `processed_count`, must not be `None`") self._processed_count = processed_count @property def status(self): """ Gets the status of this BulkResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :return: The status of this BulkResponse. :rtype: str """ return self._status @status.setter def status(self, status): """ Sets the status of this BulkResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :param status: The status of this BulkResponse. :type: str """ if status is None: raise ValueError("Invalid value for `status`, must not be `None`") allowed_values = ["new", "processing", "completed"] if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" .format(status, allowed_values) ) self._status = status @property def total_count(self): """ Gets the total_count of this BulkResponse. Total number of enrollment identities found in the input CSV. :return: The total_count of this BulkResponse. :rtype: int """ return self._total_count @total_count.setter def total_count(self, total_count): """ Sets the total_count of this BulkResponse. Total number of enrollment identities found in the input CSV. :param total_count: The total_count of this BulkResponse. :type: int """ if total_count is None: raise ValueError("Invalid value for `total_count`, must not be `None`") self._total_count = total_count def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, BulkResponse): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class BulkResponse(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, etag=None, full_report_file=None, id=None, object=None, processed_count=None, status='new', total_count=None): ''' BulkResponse - a model defined in Swagger ''' pass @property def account_id(self): ''' Gets the account_id of this BulkResponse. ID :return: The account_id of this BulkResponse. :rtype: str ''' pass @account_id.setter def account_id(self): ''' Sets the account_id of this BulkResponse. ID :param account_id: The account_id of this BulkResponse. :type: str ''' pass @property def completed_at(self): ''' Gets the completed_at of this BulkResponse. The time of completing the bulk creation task. :return: The completed_at of this BulkResponse. :rtype: datetime ''' pass @completed_at.setter def completed_at(self): ''' Sets the completed_at of this BulkResponse. The time of completing the bulk creation task. :param completed_at: The completed_at of this BulkResponse. :type: datetime ''' pass @property def created_at(self): ''' Gets the created_at of this BulkResponse. The time of receiving the bulk creation task. :return: The created_at of this BulkResponse. :rtype: datetime ''' pass @created_at.setter def created_at(self): ''' Sets the created_at of this BulkResponse. The time of receiving the bulk creation task. :param created_at: The created_at of this BulkResponse. :type: datetime ''' pass @property def errors_count(self): ''' Gets the errors_count of this BulkResponse. The number of enrollment identities with failed processing. :return: The errors_count of this BulkResponse. :rtype: int ''' pass @errors_count.setter def errors_count(self): ''' Sets the errors_count of this BulkResponse. The number of enrollment identities with failed processing. :param errors_count: The errors_count of this BulkResponse. :type: int ''' pass @property def errors_report_file(self): ''' Gets the errors_report_file of this BulkResponse. :return: The errors_report_file of this BulkResponse. :rtype: str ''' pass @errors_report_file.setter def errors_report_file(self): ''' Sets the errors_report_file of this BulkResponse. :param errors_report_file: The errors_report_file of this BulkResponse. :type: str ''' pass @property def etag(self): ''' Gets the etag of this BulkResponse. etag :return: The etag of this BulkResponse. :rtype: str ''' pass @etag.setter def etag(self): ''' Sets the etag of this BulkResponse. etag :param etag: The etag of this BulkResponse. :type: str ''' pass @property def full_report_file(self): ''' Gets the full_report_file of this BulkResponse. :return: The full_report_file of this BulkResponse. :rtype: str ''' pass @full_report_file.setter def full_report_file(self): ''' Sets the full_report_file of this BulkResponse. :param full_report_file: The full_report_file of this BulkResponse. :type: str ''' pass @property def id(self): ''' Gets the id of this BulkResponse. Bulk ID :return: The id of this BulkResponse. :rtype: str ''' pass @id.setter def id(self): ''' Sets the id of this BulkResponse. Bulk ID :param id: The id of this BulkResponse. :type: str ''' pass @property def object(self): ''' Gets the object of this BulkResponse. :return: The object of this BulkResponse. :rtype: str ''' pass @object.setter def object(self): ''' Sets the object of this BulkResponse. :param object: The object of this BulkResponse. :type: str ''' pass @property def processed_count(self): ''' Gets the processed_count of this BulkResponse. The number of enrollment identities processed until now. :return: The processed_count of this BulkResponse. :rtype: int ''' pass @processed_count.setter def processed_count(self): ''' Sets the processed_count of this BulkResponse. The number of enrollment identities processed until now. :param processed_count: The processed_count of this BulkResponse. :type: int ''' pass @property def status(self): ''' Gets the status of this BulkResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :return: The status of this BulkResponse. :rtype: str ''' pass @status.setter def status(self): ''' Sets the status of this BulkResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :param status: The status of this BulkResponse. :type: str ''' pass @property def total_count(self): ''' Gets the total_count of this BulkResponse. Total number of enrollment identities found in the input CSV. :return: The total_count of this BulkResponse. :rtype: int ''' pass @total_count.setter def total_count(self): ''' Sets the total_count of this BulkResponse. Total number of enrollment identities found in the input CSV. :param total_count: The total_count of this BulkResponse. :type: int ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
55
31
11
1
4
5
2
0.93
1
4
0
0
30
13
30
30
419
73
179
75
124
167
113
51
82
5
1
2
48
2,395
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/models/bulk_create_response.py
mbed_cloud._backends.enrollment.models.bulk_create_response.BulkCreateResponse
class BulkCreateResponse(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'account_id': 'str', 'completed_at': 'datetime', 'created_at': 'datetime', 'errors_count': 'int', 'errors_report_file': 'str', 'etag': 'str', 'full_report_file': 'str', 'id': 'str', 'object': 'str', 'processed_count': 'int', 'status': 'str', 'total_count': 'int' } attribute_map = { 'account_id': 'account_id', 'completed_at': 'completed_at', 'created_at': 'created_at', 'errors_count': 'errors_count', 'errors_report_file': 'errors_report_file', 'etag': 'etag', 'full_report_file': 'full_report_file', 'id': 'id', 'object': 'object', 'processed_count': 'processed_count', 'status': 'status', 'total_count': 'total_count' } def __init__(self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, etag=None, full_report_file=None, id=None, object=None, processed_count=None, status='new', total_count=None): """ BulkCreateResponse - a model defined in Swagger """ self._account_id = account_id self._completed_at = completed_at self._created_at = created_at self._errors_count = errors_count self._errors_report_file = errors_report_file self._etag = etag self._full_report_file = full_report_file self._id = id self._object = object self._processed_count = processed_count self._status = status self._total_count = total_count self.discriminator = None @property def account_id(self): """ Gets the account_id of this BulkCreateResponse. ID :return: The account_id of this BulkCreateResponse. :rtype: str """ return self._account_id @account_id.setter def account_id(self, account_id): """ Sets the account_id of this BulkCreateResponse. ID :param account_id: The account_id of this BulkCreateResponse. :type: str """ if account_id is None: raise ValueError("Invalid value for `account_id`, must not be `None`") self._account_id = account_id @property def completed_at(self): """ Gets the completed_at of this BulkCreateResponse. The time of completing the bulk creation task. :return: The completed_at of this BulkCreateResponse. :rtype: datetime """ return self._completed_at @completed_at.setter def completed_at(self, completed_at): """ Sets the completed_at of this BulkCreateResponse. The time of completing the bulk creation task. :param completed_at: The completed_at of this BulkCreateResponse. :type: datetime """ self._completed_at = completed_at @property def created_at(self): """ Gets the created_at of this BulkCreateResponse. The time of receiving the bulk creation task. :return: The created_at of this BulkCreateResponse. :rtype: datetime """ return self._created_at @created_at.setter def created_at(self, created_at): """ Sets the created_at of this BulkCreateResponse. The time of receiving the bulk creation task. :param created_at: The created_at of this BulkCreateResponse. :type: datetime """ if created_at is None: raise ValueError("Invalid value for `created_at`, must not be `None`") self._created_at = created_at @property def errors_count(self): """ Gets the errors_count of this BulkCreateResponse. The number of enrollment identities with failed processing. :return: The errors_count of this BulkCreateResponse. :rtype: int """ return self._errors_count @errors_count.setter def errors_count(self, errors_count): """ Sets the errors_count of this BulkCreateResponse. The number of enrollment identities with failed processing. :param errors_count: The errors_count of this BulkCreateResponse. :type: int """ if errors_count is None: raise ValueError("Invalid value for `errors_count`, must not be `None`") self._errors_count = errors_count @property def errors_report_file(self): """ Gets the errors_report_file of this BulkCreateResponse. :return: The errors_report_file of this BulkCreateResponse. :rtype: str """ return self._errors_report_file @errors_report_file.setter def errors_report_file(self, errors_report_file): """ Sets the errors_report_file of this BulkCreateResponse. :param errors_report_file: The errors_report_file of this BulkCreateResponse. :type: str """ self._errors_report_file = errors_report_file @property def etag(self): """ Gets the etag of this BulkCreateResponse. etag :return: The etag of this BulkCreateResponse. :rtype: str """ return self._etag @etag.setter def etag(self, etag): """ Sets the etag of this BulkCreateResponse. etag :param etag: The etag of this BulkCreateResponse. :type: str """ if etag is None: raise ValueError("Invalid value for `etag`, must not be `None`") if etag is not None and not re.search('[A-Za-z0-9]{0,256}', etag): raise ValueError("Invalid value for `etag`, must be a follow pattern or equal to `/[A-Za-z0-9]{0,256}/`") self._etag = etag @property def full_report_file(self): """ Gets the full_report_file of this BulkCreateResponse. :return: The full_report_file of this BulkCreateResponse. :rtype: str """ return self._full_report_file @full_report_file.setter def full_report_file(self, full_report_file): """ Sets the full_report_file of this BulkCreateResponse. :param full_report_file: The full_report_file of this BulkCreateResponse. :type: str """ self._full_report_file = full_report_file @property def id(self): """ Gets the id of this BulkCreateResponse. Bulk ID :return: The id of this BulkCreateResponse. :rtype: str """ return self._id @id.setter def id(self, id): """ Sets the id of this BulkCreateResponse. Bulk ID :param id: The id of this BulkCreateResponse. :type: str """ if id is None: raise ValueError("Invalid value for `id`, must not be `None`") if id is not None and not re.search('^[A-Za-z0-9]{32}', id): raise ValueError("Invalid value for `id`, must be a follow pattern or equal to `/^[A-Za-z0-9]{32}/`") self._id = id @property def object(self): """ Gets the object of this BulkCreateResponse. :return: The object of this BulkCreateResponse. :rtype: str """ return self._object @object.setter def object(self, object): """ Sets the object of this BulkCreateResponse. :param object: The object of this BulkCreateResponse. :type: str """ if object is None: raise ValueError("Invalid value for `object`, must not be `None`") allowed_values = ["enrollment-identity-bulk-uploads"] if object not in allowed_values: raise ValueError( "Invalid value for `object` ({0}), must be one of {1}" .format(object, allowed_values) ) self._object = object @property def processed_count(self): """ Gets the processed_count of this BulkCreateResponse. The number of enrollment identities processed until now. :return: The processed_count of this BulkCreateResponse. :rtype: int """ return self._processed_count @processed_count.setter def processed_count(self, processed_count): """ Sets the processed_count of this BulkCreateResponse. The number of enrollment identities processed until now. :param processed_count: The processed_count of this BulkCreateResponse. :type: int """ if processed_count is None: raise ValueError("Invalid value for `processed_count`, must not be `None`") self._processed_count = processed_count @property def status(self): """ Gets the status of this BulkCreateResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :return: The status of this BulkCreateResponse. :rtype: str """ return self._status @status.setter def status(self, status): """ Sets the status of this BulkCreateResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :param status: The status of this BulkCreateResponse. :type: str """ if status is None: raise ValueError("Invalid value for `status`, must not be `None`") allowed_values = ["new", "processing", "completed"] if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" .format(status, allowed_values) ) self._status = status @property def total_count(self): """ Gets the total_count of this BulkCreateResponse. Total number of enrollment identities found in the input CSV. :return: The total_count of this BulkCreateResponse. :rtype: int """ return self._total_count @total_count.setter def total_count(self, total_count): """ Sets the total_count of this BulkCreateResponse. Total number of enrollment identities found in the input CSV. :param total_count: The total_count of this BulkCreateResponse. :type: int """ if total_count is None: raise ValueError("Invalid value for `total_count`, must not be `None`") self._total_count = total_count def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, BulkCreateResponse): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class BulkCreateResponse(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, account_id=None, completed_at=None, created_at=None, errors_count=None, errors_report_file=None, etag=None, full_report_file=None, id=None, object=None, processed_count=None, status='new', total_count=None): ''' BulkCreateResponse - a model defined in Swagger ''' pass @property def account_id(self): ''' Gets the account_id of this BulkCreateResponse. ID :return: The account_id of this BulkCreateResponse. :rtype: str ''' pass @account_id.setter def account_id(self): ''' Sets the account_id of this BulkCreateResponse. ID :param account_id: The account_id of this BulkCreateResponse. :type: str ''' pass @property def completed_at(self): ''' Gets the completed_at of this BulkCreateResponse. The time of completing the bulk creation task. :return: The completed_at of this BulkCreateResponse. :rtype: datetime ''' pass @completed_at.setter def completed_at(self): ''' Sets the completed_at of this BulkCreateResponse. The time of completing the bulk creation task. :param completed_at: The completed_at of this BulkCreateResponse. :type: datetime ''' pass @property def created_at(self): ''' Gets the created_at of this BulkCreateResponse. The time of receiving the bulk creation task. :return: The created_at of this BulkCreateResponse. :rtype: datetime ''' pass @created_at.setter def created_at(self): ''' Sets the created_at of this BulkCreateResponse. The time of receiving the bulk creation task. :param created_at: The created_at of this BulkCreateResponse. :type: datetime ''' pass @property def errors_count(self): ''' Gets the errors_count of this BulkCreateResponse. The number of enrollment identities with failed processing. :return: The errors_count of this BulkCreateResponse. :rtype: int ''' pass @errors_count.setter def errors_count(self): ''' Sets the errors_count of this BulkCreateResponse. The number of enrollment identities with failed processing. :param errors_count: The errors_count of this BulkCreateResponse. :type: int ''' pass @property def errors_report_file(self): ''' Gets the errors_report_file of this BulkCreateResponse. :return: The errors_report_file of this BulkCreateResponse. :rtype: str ''' pass @errors_report_file.setter def errors_report_file(self): ''' Sets the errors_report_file of this BulkCreateResponse. :param errors_report_file: The errors_report_file of this BulkCreateResponse. :type: str ''' pass @property def etag(self): ''' Gets the etag of this BulkCreateResponse. etag :return: The etag of this BulkCreateResponse. :rtype: str ''' pass @etag.setter def etag(self): ''' Sets the etag of this BulkCreateResponse. etag :param etag: The etag of this BulkCreateResponse. :type: str ''' pass @property def full_report_file(self): ''' Gets the full_report_file of this BulkCreateResponse. :return: The full_report_file of this BulkCreateResponse. :rtype: str ''' pass @full_report_file.setter def full_report_file(self): ''' Sets the full_report_file of this BulkCreateResponse. :param full_report_file: The full_report_file of this BulkCreateResponse. :type: str ''' pass @property def id(self): ''' Gets the id of this BulkCreateResponse. Bulk ID :return: The id of this BulkCreateResponse. :rtype: str ''' pass @id.setter def id(self): ''' Sets the id of this BulkCreateResponse. Bulk ID :param id: The id of this BulkCreateResponse. :type: str ''' pass @property def object(self): ''' Gets the object of this BulkCreateResponse. :return: The object of this BulkCreateResponse. :rtype: str ''' pass @object.setter def object(self): ''' Sets the object of this BulkCreateResponse. :param object: The object of this BulkCreateResponse. :type: str ''' pass @property def processed_count(self): ''' Gets the processed_count of this BulkCreateResponse. The number of enrollment identities processed until now. :return: The processed_count of this BulkCreateResponse. :rtype: int ''' pass @processed_count.setter def processed_count(self): ''' Sets the processed_count of this BulkCreateResponse. The number of enrollment identities processed until now. :param processed_count: The processed_count of this BulkCreateResponse. :type: int ''' pass @property def status(self): ''' Gets the status of this BulkCreateResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :return: The status of this BulkCreateResponse. :rtype: str ''' pass @status.setter def status(self): ''' Sets the status of this BulkCreateResponse. The state of the process is 'new' at the time of creation. If the creation is still in progress, the state is shown as 'processing'. When the request has been fully processed, the state changes to 'completed'. :param status: The status of this BulkCreateResponse. :type: str ''' pass @property def total_count(self): ''' Gets the total_count of this BulkCreateResponse. Total number of enrollment identities found in the input CSV. :return: The total_count of this BulkCreateResponse. :rtype: int ''' pass @total_count.setter def total_count(self): ''' Sets the total_count of this BulkCreateResponse. Total number of enrollment identities found in the input CSV. :param total_count: The total_count of this BulkCreateResponse. :type: int ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
55
31
11
1
4
5
2
0.93
1
4
0
0
30
13
30
30
419
73
179
75
124
167
113
51
82
5
1
2
48
2,396
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/configuration.py
mbed_cloud._backends.enrollment.configuration.Configuration
class Configuration(object): """NOTE: This class is auto generated by the swagger code generator program. Ref: https://github.com/swagger-api/swagger-codegen Do not edit the class manually. """ def __init__(self): """Constructor""" # Default Base url self.host = "http://api.us-east-1.mbedcloud.com" # Temp file folder for downloading files self.temp_folder_path = None # Authentication Settings # dict to store API key(s) self.api_key = {} # dict to store API prefix (e.g. Bearer) self.api_key_prefix = {} # Username for HTTP basic authentication self.username = "" # Password for HTTP basic authentication self.password = "" # Logging Settings self.logger = {} self.logger["package_logger"] = logging.getLogger("enrollment") self.logger["urllib3_logger"] = logging.getLogger("urllib3") # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' # Log stream handler self.logger_stream_handler = None # Log file handler self.logger_file_handler = None # Debug file location self.logger_file = None # Debug switch self.debug = False # SSL/TLS verification # Set this to false to skip verifying SSL certificate when calling API # from https server. self.verify_ssl = True # Set this to customize the certificate file to verify the peer. self.ssl_ca_cert = None # client certificate file self.cert_file = None # client key file self.key_file = None # Set this to True/False to enable/disable SSL hostname verification. self.assert_hostname = None # urllib3 connection pool's maximum number of connections saved # per pool. urllib3 uses 1 connection as default value, but this is # not the best value when you are making a lot of possibly parallel # requests to the same host, which is often the case here. # cpu_count * 5 is used as default value to increase performance. self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 # Proxy URL self.proxy = None # Safe chars for path_param self.safe_chars_for_path_param = '' @property def logger_file(self): """The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str """ return self.__logger_file @logger_file.setter def logger_file(self, value): """The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str """ self.__logger_file = value if self.__logger_file: # If set logging file, # then add file handler and remove stream handler. self.logger_file_handler = logging.FileHandler(self.__logger_file) self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) if self.logger_stream_handler: logger.removeHandler(self.logger_stream_handler) else: # If not set logging file, # then add stream handler and remove file handler. self.logger_stream_handler = logging.StreamHandler() self.logger_stream_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_stream_handler) if self.logger_file_handler: logger.removeHandler(self.logger_file_handler) @property def debug(self): """Debug status :param value: The debug status, True or False. :type: bool """ return self.__debug @debug.setter def debug(self, value): """Debug status :param value: The debug status, True or False. :type: bool """ self.__debug = value if self.__debug: # if debug status is True, turn on debug logging for _, logger in six.iteritems(self.logger): logger.setLevel(logging.DEBUG) # turn on httplib debug httplib.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` for _, logger in six.iteritems(self.logger): logger.setLevel(logging.WARNING) # turn off httplib debug httplib.HTTPConnection.debuglevel = 0 @property def logger_format(self): """The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str """ return self.__logger_format @logger_format.setter def logger_format(self, value): """The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str """ self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) def get_api_key_with_prefix(self, identifier): """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ if (self.api_key.get(identifier) and self.api_key_prefix.get(identifier)): return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 elif self.api_key.get(identifier): return self.api_key[identifier] def get_basic_auth_token(self): """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. """ return urllib3.util.make_headers( basic_auth=self.username + ':' + self.password ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ return { 'Bearer': { 'type': 'api_key', 'in': 'header', 'key': 'Authorization', 'value': self.get_api_key_with_prefix('Authorization') }, } def to_debug_report(self): """Gets the essential information for debugging. :return: The report for debugging. """ return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 3\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version)
class Configuration(object): '''NOTE: This class is auto generated by the swagger code generator program. Ref: https://github.com/swagger-api/swagger-codegen Do not edit the class manually. ''' def __init__(self): '''Constructor''' pass @property def logger_file(self): '''The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str ''' pass @logger_file.setter def logger_file(self): '''The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str ''' pass @property def debug(self): '''Debug status :param value: The debug status, True or False. :type: bool ''' pass @debug.setter def debug(self): '''Debug status :param value: The debug status, True or False. :type: bool ''' pass @property def logger_format(self): '''The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str ''' pass @logger_format.setter def logger_format(self): '''The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str ''' pass def get_api_key_with_prefix(self, identifier): '''Gets API key (with prefix if set). :param identifier: The identifier of apiKey. :return: The token for api key authentication. ''' pass def get_basic_auth_token(self): '''Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. ''' pass def auth_settings(self): '''Gets Auth Settings dict for api client. :return: The Auth Settings information dict. ''' pass def to_debug_report(self): '''Gets the essential information for debugging. :return: The report for debugging. ''' pass
18
12
17
2
8
7
2
0.92
1
3
0
0
11
21
11
11
208
32
92
41
74
85
67
35
55
6
1
3
21
2,397
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/enrollment/apis/public_api_api.py
mbed_cloud._backends.enrollment.apis.public_api_api.PublicAPIApi
class PublicAPIApi(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client def create_bulk_device_enrollment(self, enrollment_identities, **kwargs): # noqa: E501 """Bulk upload # noqa: E501 With bulk upload, you can upload a `CSV` file containing a number of enrollment IDs. **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` \"enrollment_identity\" \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12\", \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12\", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_bulk_device_enrollment(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.create_bulk_device_enrollment_with_http_info(enrollment_identities, **kwargs) # noqa: E501 else: (data) = self.create_bulk_device_enrollment_with_http_info(enrollment_identities, **kwargs) # noqa: E501 return data def create_bulk_device_enrollment_with_http_info(self, enrollment_identities, **kwargs): # noqa: E501 """Bulk upload # noqa: E501 With bulk upload, you can upload a `CSV` file containing a number of enrollment IDs. **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` \"enrollment_identity\" \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12\", \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12\", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_bulk_device_enrollment_with_http_info(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ all_params = ['enrollment_identities'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_bulk_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'enrollment_identities' is set if ('enrollment_identities' not in params or params['enrollment_identities'] is None): raise ValueError("Missing the required parameter `enrollment_identities` when calling `create_bulk_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} if 'enrollment_identities' in params: local_var_files['enrollment_identities'] = params['enrollment_identities'] # noqa: E501 body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments-bulk-uploads', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='BulkResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def create_device_enrollment(self, enrollment_identity, **kwargs): # noqa: E501 """Place an enrollment claim for one or several devices. # noqa: E501 When the device connects to the bootstrap server and provides the enrollment ID, it will be assigned to your account. <br> **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -H 'content-type: application/json' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments \\ -d '{\"enrollment_identity\": \"A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5\"}' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_device_enrollment(enrollment_identity, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param EnrollmentId enrollment_identity: (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.create_device_enrollment_with_http_info(enrollment_identity, **kwargs) # noqa: E501 else: (data) = self.create_device_enrollment_with_http_info(enrollment_identity, **kwargs) # noqa: E501 return data def create_device_enrollment_with_http_info(self, enrollment_identity, **kwargs): # noqa: E501 """Place an enrollment claim for one or several devices. # noqa: E501 When the device connects to the bootstrap server and provides the enrollment ID, it will be assigned to your account. <br> **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -H 'content-type: application/json' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments \\ -d '{\"enrollment_identity\": \"A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5\"}' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_device_enrollment_with_http_info(enrollment_identity, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param EnrollmentId enrollment_identity: (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. """ all_params = ['enrollment_identity'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'enrollment_identity' is set if ('enrollment_identity' not in params or params['enrollment_identity'] is None): raise ValueError("Missing the required parameter `enrollment_identity` when calling `create_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'enrollment_identity' in params: body_params = params['enrollment_identity'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='EnrollmentIdentity', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def delete_bulk_device_enrollment(self, enrollment_identities, **kwargs): # noqa: E501 """Bulk delete # noqa: E501 With bulk delete, you can upload a `CSV` file containing a number of enrollment IDs to be deleted. **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` \"enrollment_identity\" \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12\", \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12\", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_bulk_device_enrollment(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.delete_bulk_device_enrollment_with_http_info(enrollment_identities, **kwargs) # noqa: E501 else: (data) = self.delete_bulk_device_enrollment_with_http_info(enrollment_identities, **kwargs) # noqa: E501 return data def delete_bulk_device_enrollment_with_http_info(self, enrollment_identities, **kwargs): # noqa: E501 """Bulk delete # noqa: E501 With bulk delete, you can upload a `CSV` file containing a number of enrollment IDs to be deleted. **Example usage:** ``` curl -X POST \\ -H 'Authorization: Bearer <valid access token>' \\ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` \"enrollment_identity\" \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12\", \"A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12\", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_bulk_device_enrollment_with_http_info(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ all_params = ['enrollment_identities'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_bulk_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'enrollment_identities' is set if ('enrollment_identities' not in params or params['enrollment_identities'] is None): raise ValueError("Missing the required parameter `enrollment_identities` when calling `delete_bulk_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} if 'enrollment_identities' in params: local_var_files['enrollment_identities'] = params['enrollment_identities'] # noqa: E501 body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments-bulk-deletes', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='BulkResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def delete_device_enrollment(self, id, **kwargs): # noqa: E501 """Delete an enrollment by ID. # noqa: E501 To free a device from your account you can delete the enrollment claim. To bypass the device ownership, you need to delete the enrollment and do a factory reset for the device. For more information, see [Transferring the ownership using First-to-Claim](/docs/current/connecting/device-ownership.html). <br> **Example usage:** ``` curl -X DELETE \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.delete_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 else: (data) = self.delete_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 return data def delete_device_enrollment_with_http_info(self, id, **kwargs): # noqa: E501 """Delete an enrollment by ID. # noqa: E501 To free a device from your account you can delete the enrollment claim. To bypass the device ownership, you need to delete the enrollment and do a factory reset for the device. For more information, see [Transferring the ownership using First-to-Claim](/docs/current/connecting/device-ownership.html). <br> **Example usage:** ``` curl -X DELETE \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `delete_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in params: path_params['id'] = params['id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_bulk_device_enrollment(self, id, **kwargs): # noqa: E501 """Get bulk upload entity # noqa: E501 Provides information on bulk upload for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk upload reports are provided. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk create task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_bulk_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 else: (data) = self.get_bulk_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 return data def get_bulk_device_enrollment_with_http_info(self, id, **kwargs): # noqa: E501 """Get bulk upload entity # noqa: E501 Provides information on bulk upload for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk upload reports are provided. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk create task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ all_params = ['id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_bulk_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `get_bulk_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in params: path_params['id'] = params['id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments-bulk-uploads/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='BulkResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_bulk_device_enrollment_delete(self, id, **kwargs): # noqa: E501 """Get bulk delete entity # noqa: E501 Provides information on bulk delete for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk delete reports are provided. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_delete(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk delete task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_bulk_device_enrollment_delete_with_http_info(id, **kwargs) # noqa: E501 else: (data) = self.get_bulk_device_enrollment_delete_with_http_info(id, **kwargs) # noqa: E501 return data def get_bulk_device_enrollment_delete_with_http_info(self, id, **kwargs): # noqa: E501 """Get bulk delete entity # noqa: E501 Provides information on bulk delete for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk delete reports are provided. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_delete_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk delete task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. """ all_params = ['id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_bulk_device_enrollment_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `get_bulk_device_enrollment_delete`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in params: path_params['id'] = params['id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments-bulk-deletes/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='BulkResponse', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_device_enrollment(self, id, **kwargs): # noqa: E501 """Get details of an enrollment by ID. # noqa: E501 To check the enrollment info in detail, for example date of claim and expiration date. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 else: (data) = self.get_device_enrollment_with_http_info(id, **kwargs) # noqa: E501 return data def get_device_enrollment_with_http_info(self, id, **kwargs): # noqa: E501 """Get details of an enrollment by ID. # noqa: E501 To check the enrollment info in detail, for example date of claim and expiration date. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. """ all_params = ['id'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_device_enrollment" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params or params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `get_device_enrollment`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in params: path_params['id'] = params['id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='EnrollmentIdentity', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_device_enrollments(self, **kwargs): # noqa: E501 """Get enrollment list. # noqa: E501 Provides a list of pending and claimed enrollments. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments ``` With query parameters: ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments?limit=10' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollments(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param int limit: Number of results to be returned. Between 2 and 1000, inclusive. :param str after: Entity ID to fetch after. :param str order: ASC or DESC :param str include: Comma-separated additional data to return. Currently supported: total_count. :return: EnrollmentIdentities If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('asynchronous'): return self.get_device_enrollments_with_http_info(**kwargs) # noqa: E501 else: (data) = self.get_device_enrollments_with_http_info(**kwargs) # noqa: E501 return data def get_device_enrollments_with_http_info(self, **kwargs): # noqa: E501 """Get enrollment list. # noqa: E501 Provides a list of pending and claimed enrollments. **Example usage:** ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ https://api.us-east-1.mbedcloud.com/v3/device-enrollments ``` With query parameters: ``` curl -X GET \\ -H 'Authorization: Bearer <valid access token>' \\ 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments?limit=10' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollments_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param int limit: Number of results to be returned. Between 2 and 1000, inclusive. :param str after: Entity ID to fetch after. :param str order: ASC or DESC :param str include: Comma-separated additional data to return. Currently supported: total_count. :return: EnrollmentIdentities If the method is called asynchronously, returns the request thread. """ all_params = ['limit', 'after', 'order', 'include'] # noqa: E501 all_params.append('asynchronous') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_device_enrollments" % key ) params[key] = val del params['kwargs'] if 'limit' in params and params['limit'] > 1000: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `get_device_enrollments`, must be a value less than or equal to `1000`") # noqa: E501 if 'limit' in params and params['limit'] < 2: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `get_device_enrollments`, must be a value greater than or equal to `2`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'limit' in params: query_params.append(('limit', params['limit'])) # noqa: E501 if 'after' in params: query_params.append(('after', params['after'])) # noqa: E501 if 'order' in params: query_params.append(('order', params['order'])) # noqa: E501 if 'include' in params: query_params.append(('include', params['include'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/v3/device-enrollments', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='EnrollmentIdentities', # noqa: E501 auth_settings=auth_settings, asynchronous=params.get('asynchronous'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
class PublicAPIApi(object): '''NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen ''' def __init__(self, api_client=None): pass def create_bulk_device_enrollment(self, enrollment_identities, **kwargs): '''Bulk upload # noqa: E501 With bulk upload, you can upload a `CSV` file containing a number of enrollment IDs. **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` "enrollment_identity" "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12", "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_bulk_device_enrollment(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def create_bulk_device_enrollment_with_http_info(self, enrollment_identities, **kwargs): '''Bulk upload # noqa: E501 With bulk upload, you can upload a `CSV` file containing a number of enrollment IDs. **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` "enrollment_identity" "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12", "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_bulk_device_enrollment_with_http_info(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def create_device_enrollment(self, enrollment_identity, **kwargs): '''Place an enrollment claim for one or several devices. # noqa: E501 When the device connects to the bootstrap server and provides the enrollment ID, it will be assigned to your account. <br> **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -H 'content-type: application/json' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments \ -d '{"enrollment_identity": "A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5"}' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_device_enrollment(enrollment_identity, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param EnrollmentId enrollment_identity: (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. ''' pass def create_device_enrollment_with_http_info(self, enrollment_identity, **kwargs): '''Place an enrollment claim for one or several devices. # noqa: E501 When the device connects to the bootstrap server and provides the enrollment ID, it will be assigned to your account. <br> **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -H 'content-type: application/json' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments \ -d '{"enrollment_identity": "A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5"}' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.create_device_enrollment_with_http_info(enrollment_identity, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param EnrollmentId enrollment_identity: (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. ''' pass def delete_bulk_device_enrollment(self, enrollment_identities, **kwargs): '''Bulk delete # noqa: E501 With bulk delete, you can upload a `CSV` file containing a number of enrollment IDs to be deleted. **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` "enrollment_identity" "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12", "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_bulk_device_enrollment(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def delete_bulk_device_enrollment_with_http_info(self, enrollment_identities, **kwargs): '''Bulk delete # noqa: E501 With bulk delete, you can upload a `CSV` file containing a number of enrollment IDs to be deleted. **Example usage:** ``` curl -X POST \ -H 'Authorization: Bearer <valid access token>' \ -F 'enrollment_identities=@/path/to/enrollments/enrollments.csv' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes ``` **An example `CSV` file:** 1. The first line is assumed to be the header. The content of the header is not validated. 2. Each line can contain comma-separated values, where the first value is always assumed to be the Enrollment ID. 3. Only one enrollment ID is expected per line. 4. Valid enrollments begin with A followed by a - and 95 characters in the format as below. 5. Valid enrollment identities may be enclosed within quotes. 6. UTF-8 encoding is expected. ``` "enrollment_identity" "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:44:71:93:23:22:15:43:23:12", "A-4E:63:2D:AE:14:BC:D1:09:77:21:95:44:ED:34:06:57:1E:03:B1:EF:0E:F2:59:25:48:44:71:22:15:43:23:12", ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_bulk_device_enrollment_with_http_info(enrollment_identities, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param file enrollment_identities: The `CSV` file containing the enrollment IDs. The maximum file size is 10MB. (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def delete_device_enrollment(self, id, **kwargs): '''Delete an enrollment by ID. # noqa: E501 To free a device from your account you can delete the enrollment claim. To bypass the device ownership, you need to delete the enrollment and do a factory reset for the device. For more information, see [Transferring the ownership using First-to-Claim](/docs/current/connecting/device-ownership.html). <br> **Example usage:** ``` curl -X DELETE \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def delete_device_enrollment_with_http_info(self, id, **kwargs): '''Delete an enrollment by ID. # noqa: E501 To free a device from your account you can delete the enrollment claim. To bypass the device ownership, you need to delete the enrollment and do a factory reset for the device. For more information, see [Transferring the ownership using First-to-Claim](/docs/current/connecting/device-ownership.html). <br> **Example usage:** ``` curl -X DELETE \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.delete_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: None If the method is called asynchronously, returns the request thread. ''' pass def get_bulk_device_enrollment(self, id, **kwargs): '''Get bulk upload entity # noqa: E501 Provides information on bulk upload for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk upload reports are provided. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk create task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def get_bulk_device_enrollment_with_http_info(self, id, **kwargs): '''Get bulk upload entity # noqa: E501 Provides information on bulk upload for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk upload reports are provided. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-uploads/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk create task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def get_bulk_device_enrollment_delete(self, id, **kwargs): '''Get bulk delete entity # noqa: E501 Provides information on bulk delete for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk delete reports are provided. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_delete(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk delete task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def get_bulk_device_enrollment_delete_with_http_info(self, id, **kwargs): '''Get bulk delete entity # noqa: E501 Provides information on bulk delete for the given ID. For example, the bulk status and the number of processed enrollment identities. Also links to the bulk delete reports are provided. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments-bulk-deletes/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_bulk_device_enrollment_delete_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Bulk delete task entity ID (required) :return: BulkResponse If the method is called asynchronously, returns the request thread. ''' pass def get_device_enrollment(self, id, **kwargs): '''Get details of an enrollment by ID. # noqa: E501 To check the enrollment info in detail, for example date of claim and expiration date. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollment(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. ''' pass def get_device_enrollment_with_http_info(self, id, **kwargs): '''Get details of an enrollment by ID. # noqa: E501 To check the enrollment info in detail, for example date of claim and expiration date. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments/{id} ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollment_with_http_info(id, asynchronous=True) >>> result = thread.get() :param asynchronous bool :param str id: Enrollment identity. (required) :return: EnrollmentIdentity If the method is called asynchronously, returns the request thread. ''' pass def get_device_enrollments(self, **kwargs): '''Get enrollment list. # noqa: E501 Provides a list of pending and claimed enrollments. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments ``` With query parameters: ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments?limit=10' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollments(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param int limit: Number of results to be returned. Between 2 and 1000, inclusive. :param str after: Entity ID to fetch after. :param str order: ASC or DESC :param str include: Comma-separated additional data to return. Currently supported: total_count. :return: EnrollmentIdentities If the method is called asynchronously, returns the request thread. ''' pass def get_device_enrollments_with_http_info(self, **kwargs): '''Get enrollment list. # noqa: E501 Provides a list of pending and claimed enrollments. **Example usage:** ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ https://api.us-east-1.mbedcloud.com/v3/device-enrollments ``` With query parameters: ``` curl -X GET \ -H 'Authorization: Bearer <valid access token>' \ 'https://api.us-east-1.mbedcloud.com/v3/device-enrollments?limit=10' ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_device_enrollments_with_http_info(asynchronous=True) >>> result = thread.get() :param asynchronous bool :param int limit: Number of results to be returned. Between 2 and 1000, inclusive. :param str after: Entity ID to fetch after. :param str order: ASC or DESC :param str include: Comma-separated additional data to return. Currently supported: total_count. :return: EnrollmentIdentities If the method is called asynchronously, returns the request thread. ''' pass
18
17
47
7
26
19
4
0.75
1
3
1
0
17
1
17
17
815
138
444
115
426
334
277
115
259
9
1
2
62
2,398
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/device_directory/models/group_1.py
mbed_cloud._backends.device_directory.models.group_1.Group1
class Group1(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'custom_attributes': 'dict(str, str)', 'description': 'str', 'name': 'str' } attribute_map = { 'custom_attributes': 'custom_attributes', 'description': 'description', 'name': 'name' } def __init__(self, custom_attributes=None, description=None, name=None): """ Group1 - a model defined in Swagger """ self._custom_attributes = custom_attributes self._description = description self._name = name self.discriminator = None @property def custom_attributes(self): """ Gets the custom_attributes of this Group1. Up to ten custom key-value attributes. :return: The custom_attributes of this Group1. :rtype: dict(str, str) """ return self._custom_attributes @custom_attributes.setter def custom_attributes(self, custom_attributes): """ Sets the custom_attributes of this Group1. Up to ten custom key-value attributes. :param custom_attributes: The custom_attributes of this Group1. :type: dict(str, str) """ self._custom_attributes = custom_attributes @property def description(self): """ Gets the description of this Group1. The description of the group :return: The description of this Group1. :rtype: str """ return self._description @description.setter def description(self, description): """ Sets the description of this Group1. The description of the group :param description: The description of this Group1. :type: str """ if description is not None and len(description) > 2000: raise ValueError("Invalid value for `description`, length must be less than or equal to `2000`") self._description = description @property def name(self): """ Gets the name of this Group1. Name of the group :return: The name of this Group1. :rtype: str """ return self._name @name.setter def name(self, name): """ Sets the name of this Group1. Name of the group :param name: The name of this Group1. :type: str """ if name is not None and len(name) > 128: raise ValueError("Invalid value for `name`, length must be less than or equal to `128`") self._name = name def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, Group1): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class Group1(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, custom_attributes=None, description=None, name=None): ''' Group1 - a model defined in Swagger ''' pass @property def custom_attributes(self): ''' Gets the custom_attributes of this Group1. Up to ten custom key-value attributes. :return: The custom_attributes of this Group1. :rtype: dict(str, str) ''' pass @custom_attributes.setter def custom_attributes(self): ''' Sets the custom_attributes of this Group1. Up to ten custom key-value attributes. :param custom_attributes: The custom_attributes of this Group1. :type: dict(str, str) ''' pass @property def description(self): ''' Gets the description of this Group1. The description of the group :return: The description of this Group1. :rtype: str ''' pass @description.setter def description(self): ''' Sets the description of this Group1. The description of the group :param description: The description of this Group1. :type: str ''' pass @property def name(self): ''' Gets the name of this Group1. Name of the group :return: The name of this Group1. :rtype: str ''' pass @name.setter def name(self): ''' Sets the name of this Group1. Name of the group :param name: The name of this Group1. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
19
13
10
1
4
5
2
0.96
1
4
0
0
12
4
12
12
161
28
68
28
49
65
44
22
31
5
1
2
19
2,399
ARMmbed/mbed-cloud-sdk-python
ARMmbed_mbed-cloud-sdk-python/src/mbed_cloud/_backends/device_directory/models/group.py
mbed_cloud._backends.device_directory.models.group.Group
class Group(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { 'custom_attributes': 'dict(str, str)', 'description': 'str', 'name': 'str' } attribute_map = { 'custom_attributes': 'custom_attributes', 'description': 'description', 'name': 'name' } def __init__(self, custom_attributes=None, description=None, name=None): """ Group - a model defined in Swagger """ self._custom_attributes = custom_attributes self._description = description self._name = name self.discriminator = None @property def custom_attributes(self): """ Gets the custom_attributes of this Group. Up to ten custom key-value attributes. :return: The custom_attributes of this Group. :rtype: dict(str, str) """ return self._custom_attributes @custom_attributes.setter def custom_attributes(self, custom_attributes): """ Sets the custom_attributes of this Group. Up to ten custom key-value attributes. :param custom_attributes: The custom_attributes of this Group. :type: dict(str, str) """ self._custom_attributes = custom_attributes @property def description(self): """ Gets the description of this Group. The description of the group :return: The description of this Group. :rtype: str """ return self._description @description.setter def description(self, description): """ Sets the description of this Group. The description of the group :param description: The description of this Group. :type: str """ if description is not None and len(description) > 2000: raise ValueError("Invalid value for `description`, length must be less than or equal to `2000`") self._description = description @property def name(self): """ Gets the name of this Group. Name of the group :return: The name of this Group. :rtype: str """ return self._name @name.setter def name(self, name): """ Sets the name of this Group. Name of the group :param name: The name of this Group. :type: str """ if name is not None and len(name) > 128: raise ValueError("Invalid value for `name`, length must be less than or equal to `128`") self._name = name def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, Group): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
class Group(object): ''' NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. ''' def __init__(self, custom_attributes=None, description=None, name=None): ''' Group - a model defined in Swagger ''' pass @property def custom_attributes(self): ''' Gets the custom_attributes of this Group. Up to ten custom key-value attributes. :return: The custom_attributes of this Group. :rtype: dict(str, str) ''' pass @custom_attributes.setter def custom_attributes(self): ''' Sets the custom_attributes of this Group. Up to ten custom key-value attributes. :param custom_attributes: The custom_attributes of this Group. :type: dict(str, str) ''' pass @property def description(self): ''' Gets the description of this Group. The description of the group :return: The description of this Group. :rtype: str ''' pass @description.setter def description(self): ''' Sets the description of this Group. The description of the group :param description: The description of this Group. :type: str ''' pass @property def name(self): ''' Gets the name of this Group. Name of the group :return: The name of this Group. :rtype: str ''' pass @name.setter def name(self): ''' Sets the name of this Group. Name of the group :param name: The name of this Group. :type: str ''' pass def to_dict(self): ''' Returns the model properties as a dict ''' pass def to_str(self): ''' Returns the string representation of the model ''' pass def __repr__(self): ''' For `print` and `pprint` ''' pass def __eq__(self, other): ''' Returns true if both objects are equal ''' pass def __ne__(self, other): ''' Returns true if both objects are not equal ''' pass
19
13
10
1
4
5
2
0.96
1
4
0
0
12
4
12
12
161
28
68
28
49
65
44
22
31
5
1
2
19