Пример #1
0
    def create(self, valid_for_days=30):
        """Create a user invitation.

        `REST API Documentation <https://os.mbed.com/search/?q=Service+API+References+/v3/accounts/{account_id}/user-invitations>`_.
        
        :param valid_for_days: Specifies how many days the invitation will be valid for.
        :type valid_for_days: int
        
        :rtype: SubtenantUserInvitation
        """

        # 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._email.value_set:
            body_params["email"] = self._email.to_api()
        if self._login_profiles.value_set:
            body_params["login_profiles"] = self._login_profiles.to_api()
        # Method parameters are unconditionally sent even if set to None
        body_params["valid_for_days"] = fields.IntegerField(
            valid_for_days).to_api()

        return self._client.call_api(
            method="post",
            path="/v3/accounts/{account_id}/user-invitations",
            content_type="application/json",
            path_params={"account_id": self._account_id.to_api()},
            body_params=body_params,
            unpack=self,
        )
    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,
        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)
Пример #4
0
    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)
    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)
Пример #6
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,
        )
    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,
        )
Пример #8
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,
        )
Пример #9
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,
        )
Пример #11
0
    def __init__(self, _client=None, minimum_length=None):
        """Creates a local `PasswordPolicy` 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 minimum_length: Minimum length for the password.
        :type minimum_length: int
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        # fields
        self._minimum_length = fields.IntegerField(value=minimum_length)
Пример #12
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,
        )
    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 __init__(
        self,
        _client=None,
        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

        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.
        :type account_id: str
        :param certificate: (Required) 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: (Required) 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: (Required) Certificate name.
        :type name: str
        :param owner_id: The ID of the owner.
        :type owner_id: str
        :param service: (Required) 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
        """

        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._certificate_fingerprint = fields.StringField(value=certificate_fingerprint)
        self._created_at = fields.DateTimeField(value=created_at)
        self._description = fields.StringField(value=description)
        self._device_execution_mode = fields.IntegerField(value=device_execution_mode)
        self._enrollment_mode = fields.BooleanField(value=enrollment_mode)
        self._id = fields.StringField(value=id)
        self._is_developer_certificate = fields.BooleanField(value=is_developer_certificate)
        self._issuer = fields.StringField(value=issuer)
        self._name = fields.StringField(value=name)
        self._owner_id = fields.StringField(value=owner_id)
        self._service = fields.StringField(value=service, enum=enums.SubtenantTrustedCertificateServiceEnum)
        self._status = fields.StringField(value=status, enum=enums.SubtenantTrustedCertificateStatusEnum)
        self._subject = fields.StringField(value=subject)
        self._updated_at = fields.DateTimeField(value=updated_at)
        self._valid = fields.BooleanField(value=valid)
        self._validity = fields.DateTimeField(value=validity)
Пример #15
0
    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)
Пример #16
0
    def __init__(
        self,
        _client=None,
        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

        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 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: (Required) 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: (Required) 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
        """

        super().__init__(_client=_client)

        # inline imports for avoiding circular references and bulk imports

        from mbed_cloud.foundation.entities.accounts.active_session import ActiveSession
        from mbed_cloud.foundation.entities.accounts.login_history import LoginHistory
        from mbed_cloud.foundation.entities.accounts.login_profile import LoginProfile

        # fields
        self._account_id = fields.StringField(value=account_id)
        self._active_sessions = fields.ListField(value=active_sessions,
                                                 entity=ActiveSession)
        self._address = fields.StringField(value=address)
        self._created_at = fields.DateTimeField(value=created_at)
        self._creation_time = fields.IntegerField(value=creation_time)
        self._custom_fields = fields.DictField(value=custom_fields)
        self._email = fields.StringField(value=email)
        self._email_verified = fields.BooleanField(value=email_verified)
        self._full_name = fields.StringField(value=full_name)
        self._id = fields.StringField(value=id)
        self._is_gtc_accepted = fields.BooleanField(value=is_gtc_accepted)
        self._is_marketing_accepted = fields.BooleanField(
            value=is_marketing_accepted)
        self._is_totp_enabled = fields.BooleanField(value=is_totp_enabled)
        self._last_login_time = fields.IntegerField(value=last_login_time)
        self._login_history = fields.ListField(value=login_history,
                                               entity=LoginHistory)
        self._login_profiles = fields.ListField(value=login_profiles,
                                                entity=LoginProfile)
        self._password = fields.StringField(value=password)
        self._password_changed_time = fields.IntegerField(
            value=password_changed_time)
        self._phone_number = fields.StringField(value=phone_number)
        self._status = fields.StringField(value=status,
                                          enum=enums.UserStatusEnum)
        self._totp_scratch_codes = fields.ListField(value=totp_scratch_codes)
        self._updated_at = fields.DateTimeField(value=updated_at)
        self._username = fields.StringField(value=username)
Пример #17
0
    def __init__(
        self,
        _client=None,
        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

        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.
        :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: (Required) 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: (Required) 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
        """

        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._creation_time = fields.IntegerField(value=creation_time)
        self._id = fields.StringField(value=id)
        self._key = fields.StringField(value=key)
        self._last_login_time = fields.IntegerField(value=last_login_time)
        self._name = fields.StringField(value=name)
        self._owner = fields.StringField(value=owner)
        self._status = fields.StringField(value=status,
                                          enum=enums.SubtenantApiKeyStatusEnum)
        self._updated_at = fields.DateTimeField(value=updated_at)