🔍 Code Extractor

class LicenseUnitsDetail

Maturity: 36

A data class representing the detailed breakdown of license units for a Microsoft 365 service SKU subscription, tracking enabled, locked out, suspended, and warning states.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/units_detail.py
Lines:
4 - 14
Complexity:
simple

Purpose

This class models the license units detail information from Microsoft Graph API, specifically tracking the status distribution of license units across different states (enabled, locked out, suspended, warning). It inherits from ClientValue, making it suitable for serialization and deserialization in API communication with Microsoft 365 services. This class is typically used when querying or managing subscription license information to understand how many units are in each state.

Source Code

class LicenseUnitsDetail(ClientValue):
    """"""

    def __init__(self, enabled=None, locked_out=None, suspended=None, warning=None):
        """
        :param int enabled: The number of units that are enabled for the active subscription of the service SKU.
        """
        self.enabled = enabled
        self.lockedOut = locked_out
        self.suspended = suspended
        self.warning = warning

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

enabled: The number of license units that are currently enabled and active for the subscription of the service SKU. This represents licenses that are available for assignment to users. Expected to be an integer value, can be None if not provided.

locked_out: The number of license units that are locked out, typically due to account issues or policy violations. Expected to be an integer value, can be None if not provided.

suspended: The number of license units that are currently suspended, usually due to payment issues or administrative actions. Expected to be an integer value, can be None if not provided.

warning: The number of license units in a warning state, potentially indicating upcoming expiration or other issues requiring attention. Expected to be an integer value, can be None if not provided.

Return Value

Instantiation returns a LicenseUnitsDetail object with four instance attributes (enabled, lockedOut, suspended, warning) representing the distribution of license units across different states. The class itself does not define any methods that return values beyond the inherited ClientValue functionality.

Class Interface

Attributes

Name Type Description Scope
enabled int or None The number of license units that are enabled and active for the subscription instance
lockedOut int or None The number of license units that are locked out due to account or policy issues instance
suspended int or None The number of license units that are currently suspended instance
warning int or None The number of license units in a warning state requiring attention instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue
from office365.directory.licenses.units_detail import LicenseUnitsDetail

# Create a license units detail object with all parameters
license_detail = LicenseUnitsDetail(
    enabled=100,
    locked_out=5,
    suspended=3,
    warning=2
)

# Access the attributes
print(f"Enabled units: {license_detail.enabled}")
print(f"Locked out units: {license_detail.lockedOut}")
print(f"Suspended units: {license_detail.suspended}")
print(f"Warning units: {license_detail.warning}")

# Create with partial information
partial_detail = LicenseUnitsDetail(enabled=50)
print(f"Enabled: {partial_detail.enabled}, Suspended: {partial_detail.suspended}")

# Typically used when deserializing API responses
# The ClientValue base class handles serialization/deserialization

Best Practices

  • This class is primarily a data container and should be instantiated with appropriate integer values or None for each parameter.
  • The class uses camelCase for the 'lockedOut' attribute internally, which differs from the snake_case constructor parameter 'locked_out'. Be aware of this naming convention when accessing attributes.
  • As a ClientValue subclass, this object is designed for serialization/deserialization with Microsoft Graph API responses. Let the parent class handle JSON conversion.
  • All parameters are optional and default to None, allowing partial initialization when not all license state information is available.
  • This class is immutable in practice - attributes are set during initialization and typically not modified afterward.
  • When used in API contexts, this object is usually created automatically during deserialization of API responses rather than manually instantiated.
  • The class does not perform validation on the input values, so ensure that integer values are provided where expected.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class LicenseDetails 73.4% similar

    A data class representing license details assigned to a user in Microsoft 365/Azure AD, providing read-only access to service plans, SKU identifiers, and SKU part numbers.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/details.py
  • class AssignedLicense 67.3% similar

    Represents a license assigned to a user in Microsoft 365/Office 365, containing the SKU identifier and any disabled plans associated with that license.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/assigned_license.py
  • class LicenseAssignmentState 67.0% similar

    Represents the license assignment state for a user in Microsoft 365/Office 365, tracking how licenses are assigned (directly or via group) and their current status.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/assignment_state.py
  • class SubscribedSku 66.3% similar

    A class representing a service SKU (Stock Keeping Unit) subscription for a company, providing access to license and service plan information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/subscribed_sku.py
  • class AppLicense 65.4% similar

    AppLicense is a data class that represents a marketplace license in the Office 365 ecosystem, inheriting from ClientValue to provide serialization capabilities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/apps/license.py
← Back to Browse