def __init__(self,
                 _client=None,
                 color=None,
                 reference=None,
                 updated_at=None):
        """Creates a local `SubtenantDarkThemeColor` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._color = fields.StringField(value=color)
        self._reference = fields.StringField(
            value=reference, enum=enums.SubtenantDarkThemeColorReferenceEnum)
        self._updated_at = fields.DateTimeField(value=updated_at)
Exemplo n.º 2
0
    def __init__(self,
                 _client=None,
                 admin_email=None,
                 admin_name=None,
                 id=None):
        """Creates a local `ParentAccount` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._admin_email = fields.StringField(value=admin_email)
        self._admin_name = fields.StringField(value=admin_name)
        self._id = fields.StringField(value=id)
Exemplo n.º 3
0
    def __init__(self,
                 _client=None,
                 created_at=None,
                 endpoint_name=None,
                 id=None):
        """Creates a local `PreSharedKey` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._created_at = fields.DateTimeField(value=created_at)
        self._endpoint_name = fields.StringField(value=endpoint_name)
        self._id = fields.StringField(value=id)
Exemplo n.º 4
0
    def __init__(self, _client=None, created_at=None, id=None, server_certificate=None, server_uri=None):
        """Creates a local `ServerCredentials` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._created_at = fields.DateTimeField(value=created_at)
        self._id = fields.StringField(value=id)
        self._server_certificate = fields.StringField(value=server_certificate)
        self._server_uri = fields.StringField(value=server_uri)
    def __init__(self,
                 _client=None,
                 reference=None,
                 static_uri=None,
                 updated_at=None):
        """Creates a local `DarkThemeImage` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._reference = fields.StringField(
            value=reference, enum=enums.DarkThemeImageReferenceEnum)
        self._static_uri = fields.StringField(value=static_uri)
        self._updated_at = fields.DateTimeField(value=updated_at)
    def __init__(self, _client=None, date=None, ip_address=None, success=None, user_agent=None):
        """Creates a local `LoginHistory` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._date = fields.DateTimeField(value=date)
        self._ip_address = fields.StringField(value=ip_address)
        self._success = fields.BooleanField(value=success)
        self._user_agent = fields.StringField(value=user_agent)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    def __init__(
        self,
        _client=None,
        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

        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: (Required) 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: (Required) Email address of the invited user.
        :type email: str
        :param expiration: Invitation expiration as UTC time RFC3339.
        :type expiration: datetime
        :param id: (Required) 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        from mbed_cloud.foundation.entities.accounts.login_profile import LoginProfile

        # fields
        self._account_id = fields.StringField(value=account_id)
        self._created_at = fields.DateTimeField(value=created_at)
        self._email = fields.StringField(value=email)
        self._expiration = fields.DateTimeField(value=expiration)
        self._id = fields.StringField(value=id)
        self._login_profiles = fields.ListField(value=login_profiles,
                                                entity=LoginProfile)
        self._updated_at = fields.DateTimeField(value=updated_at)
        self._user_id = fields.StringField(value=user_id)
    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)
    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)
    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)
Exemplo n.º 12
0
    def create(self, secret_hex):
        """Upload a PSK to Pelion Device Management.

        `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v2/device-shared-keys>`_.
        
        :param secret_hex: The secret of the PSK in hexadecimal. It is not case sensitive; 4a is
            same as 4A, and it is allowed with or without 0x in the beginning. The
            minimum length of the secret is 128 bits and maximum 256 bits.
        :type secret_hex: str
        
        :rtype: PreSharedKey
        """

        # 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["endpoint_name"] = self._id.to_api()
        # Method parameters are unconditionally sent even if set to None
        body_params["secret_hex"] = fields.StringField(secret_hex).to_api()

        return self._client.call_api(
            method="post",
            path="/v2/device-shared-keys",
            content_type="application/json",
            body_params=body_params,
            unpack=self,
        )
Exemplo n.º 13
0
def _to_query_param(sdk_value):
    """Convert a standard Python value to a value suitable for a query parameter value.

    Note: This will not URL encode as this will be performed by the `requests` library

    :param sdk_value: filter value
    :return Value suitable for the query string
    """
    # The values in a list need to be serialised individually to be rendered properly
    if isinstance(sdk_value, list):
        encoded_list = []
        for list_value in sdk_value:
            # Convert serialised value to string as the query parameter must be a string of comma separated values
            encoded_list.append(str(_to_query_param(list_value)))
        sdk_value = encoded_list

    # If an entity has been provided as a value, extract the ID from the instance
    if isinstance(sdk_value, Entity):
        sdk_value = sdk_value.id

    # Loop over the supported field types to find the type of the value and then serialise.
    for field_type in _valid_field_types:
        if isinstance(sdk_value, field_type.base_type):
            return field_type(sdk_value).to_query_param()
    # Default to a string field - this will happen for None values
    return fields.StringField(sdk_value).to_query_param()
    def update(self, account_id):
        """Updates a dark theme branding color.

        `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/accounts/{account_id}/branding-colors/dark/{reference}>`_.
        
        :param account_id: Account ID.
        :type account_id: str
        
        :rtype: SubtenantDarkThemeColor
        """

        # 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._color.value_set:
            body_params["color"] = self._color.to_api()
        if self._updated_at.value_set:
            body_params["updated_at"] = self._updated_at.to_api()

        return self._client.call_api(
            method="put",
            path="/v3/accounts/{account_id}/branding-colors/dark/{reference}",
            content_type="application/json",
            path_params={
                "account_id": fields.StringField(account_id).to_api(),
                "reference": self._reference.to_api()
            },
            body_params=body_params,
            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 _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,
        )
Exemplo n.º 17
0
    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,
        )
Exemplo n.º 18
0
    def _paginate_list(self,
                       after=None,
                       filter=None,
                       order="ASC",
                       limit=50,
                       include=None):
        """Get all trusted certificates.
        
        :param after: The entity ID to fetch after the given one.
        :type after: str
        
        :param filter: Optional API filter for listing resources.
        :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 limit: The number of results to return (2-1000). Default 50.
        :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.TrustedCertificateOrderEnum).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/trusted-certificates",
            content_type="application/json",
            query_params=query_params,
            unpack=False,
        )
Exemplo n.º 19
0
    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 _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 __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)
Exemplo n.º 22
0
    def _paginate_list(self,
                       after=None,
                       filter=None,
                       order=None,
                       limit=None,
                       include=None):
        """List PSKs.
        
        :param after: An offset token for fetching a specific page. Provided by the server.
        :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: The number of entries per page.
        :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).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="/v2/device-shared-keys",
            content_type="application/json",
            query_params=query_params,
            unpack=False,
        )
Exemplo n.º 23
0
    def __init__(self,
                 _client=None,
                 action=None,
                 allow=None,
                 feature=None,
                 inherited=None,
                 resource=None):
        """Creates a local `Policy` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._action = fields.StringField(value=action)
        self._allow = fields.BooleanField(value=allow)
        self._feature = fields.StringField(value=feature)
        self._inherited = fields.BooleanField(value=inherited)
        self._resource = fields.StringField(value=resource)
Exemplo n.º 24
0
    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)
    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)
    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)
Exemplo n.º 27
0
    def __init__(self,
                 _client=None,
                 account_id=None,
                 ip_address=None,
                 login_time=None,
                 reference_token=None,
                 user_agent=None):
        """Creates a local `ActiveSession` 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 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._account_id = fields.StringField(value=account_id)
        self._ip_address = fields.StringField(value=ip_address)
        self._login_time = fields.DateTimeField(value=login_time)
        self._reference_token = fields.StringField(value=reference_token)
        self._user_agent = fields.StringField(value=user_agent)
Exemplo n.º 28
0
    def __init__(self, _client=None, id=None, name=None):
        """Creates a local `LoginProfile` 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 id: ID of the identity provider.
        :type id: str
        :param name: Name of the identity provider.
        :type name: str
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._id = fields.StringField(value=id)
        self._name = fields.StringField(value=name)
    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,
        )
Exemplo n.º 30
0
    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)