Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connect/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from deprecation import deprecated
import six

from .models.parameters import Param
from .models.param import Param


class Message(Exception):
Expand Down
59 changes: 45 additions & 14 deletions connect/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,55 @@
# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from .activation_response import ActivationTemplateResponse, ActivationTileResponse
from .activation import Activation
from .activation_template_response import ActivationTemplateResponse
from .activation_tile_response import ActivationTileResponse
from .agreement import Agreement
from .agreement_stats import AgreementStats
from .asset import Asset
from .base import BaseModel
from .company import Company, User
from .company import Company
from .configuration import Configuration
from .connection import Connection
from .contact import Contact, ContactInfo, PhoneNumber
from .conversation import Conversation, ConversationMessage
from .event import EventInfo, Events
from .constraints import Constraints
from .contact import Contact
from .contact_info import ContactInfo
from .contract import Contract
from .conversation import Conversation
from .conversation_message import ConversationMessage
from .customer_ui_settings import CustomerUiSettings
from .document import Document
from .download_link import DownloadLink
from .event import Event
from .events import Events
from .ext_id_hub import ExtIdHub
from .fulfillment import Fulfillment
from .hub import Hub, HubInstance, ExtIdHub, HubStats
from .marketplace import Activation, Agreement, AgreementStats, Contract, Marketplace
from .parameters import Constraints, Param, ValueChoice
from .product import CustomerUiSettings, Document, DownloadLink, Item, Product, \
ProductCategory, ProductConfiguration, ProductFamily, ProductStats, ProductStatsInfo, Renewal
from .hub import Hub
from .hub_instance import HubInstance
from .hub_stats import HubStats
from .item import Item
from .marketplace import Marketplace
from .param import Param
from .phone_number import PhoneNumber
from .product import Product
from .product_category import ProductCategory
from .product_configuration import ProductConfiguration
from .product_family import ProductFamily
from .product_stats import ProductStats
from .product_stats_info import ProductStatsInfo
from .renewal import Renewal
from .server_error_response import ServerErrorResponse
from .tier_config import Configuration, Template, TierAccount, TierAccounts, TierConfig, \
TierConfigRequest
from .usage import UsageFile, UsageListing, UsageRecord, UsageRecords
from .template import Template
from .tier_account import TierAccount
from .tier_accounts import TierAccounts
from .tier_config import TierConfig
from .tier_config_request import TierConfigRequest
from .usage_file import UsageFile
from .usage_listing import UsageListing
from .usage_record import UsageRecord
from .usage_records import UsageRecords
from .user import User
from .value_choice import ValueChoice

__all__ = [
'Activation',
Expand All @@ -42,7 +73,7 @@
'CustomerUiSettings',
'Document',
'DownloadLink',
'EventInfo',
'Event',
'Events',
'ExtIdHub',
'Fulfillment',
Expand Down
25 changes: 25 additions & 0 deletions connect/models/activation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

import datetime
from typing import Optional

from .base import BaseModel
from .schemas import ActivationSchema


class Activation(BaseModel):
""" Activation object. """

_schema = ActivationSchema()

link = None # type: Optional[str]
""" (str|None) Activation link. """

message = None # type: str
""" (str) Activation message. """

date = None # type: Optional[datetime.datetime]
""" (datetime.datetime|None) Activation date. """
21 changes: 21 additions & 0 deletions connect/models/activation_template_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.


class ActivationTemplateResponse(object):
""" An instance of this class might the returned by the overriden ``process_request`` method
of your :py:class:`connect.resources.FulfillmentAutomation` or
:py:class:`connect.resources.TierConfigAutomation` subclass to approve the request being
processed, showing a tile with the specified template id.

:param str template_id: Id of the template od the tile to be shown in the Vendor Portal.
The template must have been defined in the Vendor Portal.
:rtype: None
"""

template_id = None # type: str

def __init__(self, template_id):
self.template_id = template_id
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,3 @@ def __init__(self, markdown=''):
self.tile = json.loads(markdown)
except ValueError:
self.tile = markdown or self.__class__.tile


class ActivationTemplateResponse(object):
""" An instance of this class might the returned by the overriden ``process_request`` method
of your :py:class:`connect.resources.FulfillmentAutomation` or
:py:class:`connect.resources.TierConfigAutomation` subclass to approve the request being
processed, showing a tile with the specified template id.

:param str template_id: Id of the template od the tile to be shown in the Vendor Portal.
The template must have been defined in the Vendor Portal.
:rtype: None
"""

template_id = None # type: str

def __init__(self, template_id):
self.template_id = template_id
76 changes: 76 additions & 0 deletions connect/models/agreement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

import datetime
from typing import Optional, List

from .agreement_stats import AgreementStats
from .base import BaseModel
from .company import Company
from .marketplace import Marketplace
from .user import User
from .schemas import AgreementSchema


class Agreement(BaseModel):
""" An Agreement object. """

_schema = AgreementSchema()

type = None # type: str
""" (str) Type of the agreement. One of: distribution, program, service. """

title = None # type: str
""" (str) Title of the agreement. """

description = None # type: str
""" (str) Agreement details (Markdown). """

created = None # type: datetime.datetime
""" (datetime.datetime) Date of creation of the agreement. """

updated = None # type: datetime.datetime
""" (datetime.datetime) Date of the update of the agreement. It can be creation
of the new version, change of the field, etc. (any change).
"""

owner = None # type: Company
""" (:py:class:`.Company`) Reference to the owner account object. """

stats = None # type: Optional[AgreementStats]
""" (:py:class:`.AgreementStats` | None) Agreement stats. """

author = None # type: Optional[User]
""" (:py:class:`.User` | None) Reference to the user who created the version. """

version = None # type: int
""" (int) Chronological number of the version. """

active = None # type: bool
""" (bool) State of the version. """

link = None # type: str
""" (str) Url to the document. """

version_created = None # type: datetime.datetime
""" (datetime.datetime) Date of the creation of the version. """

version_contracts = None # type: int
""" (int) Number of contracts this version has. """

agreements = None # type: List[Agreement]
""" (List[:py:class:`.Agreement`]) Program agreements can have distribution agreements
associated with them.
"""

parent = None # type: Optional[Agreement]
""" (:py:class:`.Agreement` | None) Reference to the parent program agreement
(for distribution agreement).
"""

marketplace = None # type: Optional[Marketplace]
""" (:py:class:`.Marketplace` | None) Reference to marketplace object
(for distribution agreement).
"""
21 changes: 21 additions & 0 deletions connect/models/agreement_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from typing import Optional

from .base import BaseModel
from .schemas import AgreementStatsSchema


class AgreementStats(BaseModel):
""" Agreement stats. """

_schema = AgreementStatsSchema()

contracts = None # type: Optional[int]
""" (int|None) Number of contracts this agreement has. """

versions = None # type: int
""" (int) Number of versions in the agreement. """
9 changes: 5 additions & 4 deletions connect/models/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

from .base import BaseModel
from .connection import Connection
from .parameters import Param
from .product import Item, Product
from .tier_config import TierAccounts
from connect.models.schemas import AssetSchema
from .item import Item
from .param import Param
from .product import Product
from .tier_accounts import TierAccounts
from .schemas import AssetSchema


class Asset(BaseModel):
Expand Down
11 changes: 1 addition & 10 deletions connect/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from .base import BaseModel
from connect.models.schemas import CompanySchema, UserSchema
from .schemas import CompanySchema


class Company(BaseModel):
Expand All @@ -14,12 +14,3 @@ class Company(BaseModel):

name = None # type: str
""" (str) Company name. """


class User(BaseModel):
""" Represents a user within the platform. """

_schema = UserSchema()

name = None # type: str
""" (str) User name. """
27 changes: 27 additions & 0 deletions connect/models/configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from typing import List

from .base import BaseModel
from .param import Param
from .schemas import ConfigurationSchema


class Configuration(BaseModel):
""" Configuration Phase Parameter Context-Bound Data Object.

To be used in parameter contexts:

- Asset.
- Fulfillment Request.
- TierConfig.
- TierConfig Requests.
"""

_schema = ConfigurationSchema()

params = None # type: List[Param]
""" (List[:py:class:`.Param`]) """
2 changes: 1 addition & 1 deletion connect/models/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .company import Company
from .hub import Hub
from .product import Product
from connect.models.schemas import ConnectionSchema
from .schemas import ConnectionSchema


class Connection(BaseModel):
Expand Down
28 changes: 28 additions & 0 deletions connect/models/constraints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-

# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from typing import List

from .base import BaseModel
from .value_choice import ValueChoice
from .schemas import ConstraintsSchema


class Constraints(BaseModel):
""" Parameter constraints. """

_schema = ConstraintsSchema()

hidden = None # type: bool
""" (bool) Is the parameter hidden? """

required = None # type: bool
""" (bool) Is the parameter required? """

choices = None # type: List[ValueChoice]
""" (List[:py:class:`.ValueChoice`]) Parameter value choices. """

unique = None # type: bool
""" (bool) Is the constraint unique? """
Loading