Пример #1
0
 def _process_response(resp):
     for grp in groups:  # type: Group
         if "Team" in grp.properties["resourceProvisioningOptions"]:
             new_team = Team(self.context, ResourcePath(grp.id, self.resource_path))
             for k, v in grp.properties.items():
                 new_team.set_property(k, v)
             self.add_child(new_team)
Пример #2
0
 def _process_response(resp):
     for grp in groups:
         if "Team" in grp.properties["resourceProvisioningOptions"]:
             new_team = Team(
                 self.context,
                 ResourcePath(grp.properties["id"], self.resource_path))
             new_team.set_property("id", grp.properties["id"])
             self.add_child(new_team)
 def _init_teams(groups):
     """
     :type groups: GroupCollection
     """
     for grp in groups:  # type: Group
         if "Team" in grp.properties["resourceProvisioningOptions"]:
             team = Team(self.context,
                         ResourcePath(grp.id, self.resource_path))
             for k, v in grp.properties.items():
                 team.set_property(k, v)
             self.add_child(team)
Пример #4
0
    def add_team(self):
        """Create a new team under a group."""
        team = Team(self.context, ResourcePath("team", self.resource_path))
        team._parent_collection = self.parent_collection
        qry = ServiceOperationQuery(self, "team", None, team, None, team)
        self.context.add_query(qry)

        def _construct_create_team_request(request):
            cur_qry = self.context.pending_request().current_query
            if cur_qry.id == qry.id:
                request.method = HttpMethod.Put
                request.set_header('Content-Type', "application/json")
                request.data = json.dumps(request.data)
        self.context.before_execute(_construct_create_team_request, False)
        return team
Пример #5
0
 def add_team(self):
     """Create a new team under a group."""
     team = Team(self.context)
     qry = ServiceOperationQuery(self, "team", None, team, None, team)
     self.context.add_query(qry)
     self.context.get_pending_request().beforeExecute += self._construct_create_team_request
     return team
    def create(self, group_name):
        """Provision a new team along with a group.

        :type group_name: str
        :rtype: ClientResult
        """

        grp_properties = GroupProfile(group_name)
        grp_properties.securityEnabled = False
        grp_properties.mailEnabled = True
        grp_properties.groupTypes = ["Unified"]
        target_group = self.context.groups.add(grp_properties)
        result = ClientResult(self.context, Team(self.context))

        def _group_created(resp):
            result.value = target_group.add_team()
        self.context.after_execute(_group_created)
        return result
 def __getitem__(self, key):
     if type(key) == int:
         return self._data[key]
     return Team(self.context, ResourcePath(key, self.resource_path))
Пример #8
0
 def __getitem__(self, key):
     """
     :rtype: Team
     """
     return Team(self.context, ResourcePath(key, self.resource_path))
 def __getitem__(self, key):
     return Team(self.context, ResourcePath(key, self.resource_path))
Пример #10
0
 def _process_response(resp):
     for grp in groups:
         if "Team" in grp.properties["resourceProvisioningOptions"]:
             self.add_child(Team(self.context, ResourcePath(grp.properties["id"], self.resource_path)))