def list(self,
             filter=None,
             order=None,
             max_results=None,
             page_size=None,
             include=None):
        """Get metadata of all dark theme images.

        `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/branding-images/dark>`_.
        
        :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(DarkThemeImage)
        """

        from mbed_cloud.foundation._custom_methods import paginate
        from mbed_cloud.foundation import DarkThemeImage
        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=DarkThemeImage._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 = DarkThemeImage._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=DarkThemeImage,
            filter=filter,
            order=order,
            max_results=max_results,
            page_size=page_size,
            include=include,
            wraps=self._paginate_list,
        )
    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,
        )
Exemple #3
0
    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):
        """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 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,
        )
Exemple #6
0
    def list(self,
             filter=None,
             order="ASC",
             max_results=None,
             page_size=50,
             include=None):
        """Get the details of all users.

        `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/users>`_.

        **API Filters**

        The following filters are supported by the API when listing User entities:

        +----------------+------+------+------+------+------+------+------+
        | Field          | eq   | neq  | gte  | lte  | in   | nin  | like |
        +================+======+======+======+======+======+======+======+
        | email          | Y    |      |      |      |      |      |      |
        +----------------+------+------+------+------+------+------+------+
        | login_profiles | Y    |      |      |      |      |      |      |
        +----------------+------+------+------+------+------+------+------+
        | status         | Y    |      |      |      | Y    | Y    |      |
        +----------------+------+------+------+------+------+------+------+

        **Example Usage**

        .. code-block:: python

            from mbed_cloud.foundation import User
            from mbed_cloud import ApiFilter

            api_filter = ApiFilter()
            api_filter.add_filter("email", "eq", <filter value>)
            for user in User().list(filter=api_filter):
                print(user.email)
        
        :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: Record order based on creation time. 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: The number of results to return (2-1000). Default 50.
        :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(User)
        """

        from mbed_cloud.foundation._custom_methods import paginate
        from mbed_cloud.foundation import User
        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=User._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 = User._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=User,
            filter=filter,
            order=order,
            max_results=max_results,
            page_size=page_size,
            include=include,
            wraps=self._paginate_list,
        )
    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,
        )