Organizations

class smartcloudadmin.models.organization.Organization(environment: str, id: int = 0, name: str = '', address_set: smartcloudadmin.models.address_set.AddressSet = '', contact: smartcloudadmin.models.contact.Contact = '', language_preference: str = 'en_US', state: str = '', time_zone: str = 'America/Central', payment_method_type: str = 'PURCHASE_ORDER', currency_type: str = 'USD', owner: int = 0, created: datetime.datetime = '01/01/1970 00:00:00', modified: datetime.datetime = '01/01/1970 00:00:00', party_type: str = <PartyType.ORGANISATION: 'ORGANIZATION'>, security_realm: str = 'NON_FEDERATED', industry='')

Bases: object

Represents an Organization within IBM Social CLoud.

Supported Operations:

Operation Description
x == y Test whether 2 Organization objects contain the same data
x != y Test whether 2 Organization objects do not contain the same data
str(x) Returns basic details about the Organization
id : int
The id of the Organization. May be referred to as Customer Id/
name : str
Name of the Organization
environment : str
location where the organization is hosted. I.E. North America, Central Europe or Asia Pacific
contact : Contact
Object containing details about Organization owner.
address_set : AddressSet
Object containing physical address of the Organization.
language_preference : LanguagePreference
Language preference when interacting with BSS through UI.
state : State
Current state of the Organization. I.E. Active
time_zone : TimeZone
Timezone the Organization is located in.
payment_method_type : PaymentMethodType
Payment method used by Organization
currency_type : CurrencyType
Currency the Organization pays in.
created : Datetime
Creation time for the organization given in the format of %Y/%m/%d %H:%M:%S
modified : Datetime
Modification time for the organization given in the format of %Y/%m/%d %H:%M:%S
party_type : PartyType
Party Type
security_realm : SecurityRealm
Security configuration of the Organization. I.E. Federated/Non-federated.
subscriptions : {Subscription}
A dictionary of Subscriber objects where the key is the Subscriber Id
subscribers : {Subscriber}
A dictionary of Subscription objects where the key is the Subscription Id
admins: {Subscriber}
A dictionary of Subscription objects where the key is the Subscription Id
size : str
A range of the number of users in an Organization. i.E 100<500
industry : str
The business or industry the Organization is in.
vendor_id : int
Vendor id of the Organization. I.E. 10.
is_guest : bool
Current state of the Organization. I.E. Active
customer_type : CustomerType
Current state of the Organization. I.E. Active
is_partner : bool
Whether or not the Organization is an IBM partner.
is_sync_pending : bool
Current state of the Organization. I.E. Active
last_sync_date : bool
Current state of the Organization. I.E. Active
add_subscriber(*, email_address, given_name, family_name, **kawrgs) → smartcloudadmin.models.subscriber.Subscriber

Adds a new user to the Organization.

For a full list of optional params see bssapi.models.subscriber.Subscriber.create()

Parameters:
  • email_address – User’s email address
  • given_name – User’s first name
  • family_name – User’s surname
Raises:

PermissionError: User is not authorised to execute this request.

Returns:

Newly created Subscriber.

Return type:

Subscriber

Example:
>>> Subscriber.create(given_name="Tim", family_name="Tom" ,email_address="tim.tom@tam.net")
add_subscription(*, part_number, part_quantity, duration_length, duration_units) → smartcloudadmin.models.subscription.Subscription

Adds a new subscription to an Organization.

For a full list of optional params see bssapi.models.subscriber.Subscription.create()

Parameters:
  • part_number – Subscription part number. I.E. D0NPULL for Connections Cloud.
  • part_quantity – Number of seats
  • duration_length – length of Subscription duration units
  • duration_units – options YEARS or MONTHS ( possibly DAYS )
Returns:

Created Subscription object

Return type:

Subscription

Raises:

PermissionError – User is not authorised to execute this request.

:example :
>>> my_organisation.add_subscription(part_number="D0NPULL", part_quantity=25, duration_length=1,
duration_units="YEARS")
check_for_updates() → bool

Compares current Organization object with live server data and updates if there are differences.

Returns:if an update was made
Return type:bool
Example:
>>> my_organization.check_for_updates()
country

Country of which the Organization resides as per address_set.

Returns:Country the Organization is located in
Return type:str
classmethod create(environment: str, organisation_name: str, given_name: str, family_name: str, admin_email: str, **kwargs) → smartcloudadmin.models.organization.Organization

Creates a new organisation on BSS and returns organisation object.

Parameters:
  • environment – Environment of the organisation , e.g. A3,G3,S3
  • organisation_name – Name of the organisation.
  • given_name – First name of the organisation owner.
  • family_name – Surname of the organisation owner.
  • admin_email – Email address for the organisation admin
Returns:

an organisation object

Raises:

PermissionError: User is not authorised to execute this request.

Return type:

Organization

Example:
>>> resp = bss_api.create_org(environment, body)
delete() → None

Deletes the Organization.

Raises:

PermissionError: User is not authorised to execute this request.

Example:
>>> my_organization.delete()
filter_subscribers(*, attribute, attribute_value, passed_operator=<built-in function eq>) → {<class 'smartcloudadmin.models.subscriber.Subscriber'>}

Returns a filtered subscriber list based instance attributes and queried attribute value. For greater than / less than queries it makes sense to think of it as : Is subscriber.modified date greater ( newer ) than attribute_value?

Parameters:
  • attribute – Subscriber attribute that is being filtered.
  • attribute_value – Value of attribute you want to filter against.
  • passed_operator – Operator to be carried out agaisnt attribute and value. E.G. State is not equal to ACTIVE.
Returns:

[Subscriber]

Raises:

PermissionError – User is not authorised to execute this request.

:example : my_organisation.filter_subscribers(attribute=”state”, attribute_value=”ACTIVE”, passed_operator=operator.ne)

filter_subscriptions(*, attribute, attribute_value, passed_operator=<built-in function eq>) → {<class 'smartcloudadmin.models.subscription.Subscription'>}

Returns a filtered subscriber list based instance attributes and queried attribute value. For greater than / less than queries it makes sense to think of it as : Is subscription.modified date greater ( newer ) than attribute_value?

Parameters:
  • attribute – Subscription attribute that is being filtered.
  • attribute_value – Value of attribute you want to filter against.
  • passed_operator – Operator to be carried out agaisnt attribute and value. E.G. State is

not equal to ACTIVE. :returns: A List of subscriptions that match the given query :rtype: {Subscription} :raises PermissionError: User is not authorised to execute this request.

Example:
>>> my_organisation.filter_subscriptions(attribute="state", attribute_value="ACTIVE",passed_operator=operator.ne)
classmethod from_json(environment, json_body) → smartcloudadmin.models.organization.Organization

Creates an Organization object from a JSON payload, for example when retrieving many orgs or organization searches :param environment: Datacenter :param json_body: JSON Payload :return: Organization :rtype: Organization

classmethod get(environment: str, organization_id: int) → smartcloudadmin.models.organization.Organization

Creates a new organisation on BSS and returns that organisation object.

Parameters:
  • environment – Environment of the organisation , e.g. NA, CE, AP
  • organization_id – Name of the organisation.
Returns:

Retrieved Organization

Return type:

Organization

Raises:

PermissionError: User is not authorised to execute this request.

Example:

>>>resp = bss_api.create_org(environment, body)

classmethod get_basic(environment: str, organization_id: int) → smartcloudadmin.models.organization.Organization

Gets an Organization object with basic Organization details. Does not retrieve subscription or subscriber information. :param environment: Datacenter where the Organization resides :param organization_id: Organization id :return: a Basic Organization :rtype: Organization

remove_subscriber(subscriber: smartcloudadmin.models.subscriber.Subscriber) → None

Removes the Subscriber

Parameters:subscriber
Returns:None
Example:
>>> tom = Subscriber.get("A3", 2142424)
>>> my_organization.remove_subscriber(tom)
remove_subscription(subscription: smartcloudadmin.models.subscription.Subscription) → None

Returns a filtered subscriber list based instance attributes and queried attribute value. For greater than / less than queries it makes sense to think of it as : Is subscriber.modified date greater ( newer ) than attribute_value?

Parameters:subscription – Subscription to delete
Raises:PermissionError – User is not authorised to execute this request.
>>> connections_subscription = Subscription.get("A3",121242)
>>> my_organization.remove_subscription(connections_subscription)
subscriber_count
subscription_count

The number of subscriptions the Organization has.

Returns:The number of Subscriptions
Return type:int
suspend() → None

Suspends the Organization.

Raises:

PermissionError: User is not authorised to execute this request.

Example:
>>> my_organization.suspend()
unsuspend() → None

Unuspends the Organization.

Raises:

PermissionError: User is not authorised to execute this request.

Example:
>>> my_organization.unsuspend()