|
| 1 | +from office365.admin.microsoft365_apps import AdminMicrosoft365Apps |
| 2 | +from office365.admin.people_settings import PeopleAdminSettings |
| 3 | +from office365.admin.report_settings import AdminReportSettings |
| 4 | +from office365.admin.sharepoint import Sharepoint |
| 5 | +from office365.entity import Entity |
| 6 | +from office365.intune.servicecommunications.announcement import ServiceAnnouncement |
| 7 | +from office365.runtime.paths.resource_path import ResourcePath |
| 8 | + |
| 9 | + |
| 10 | +class Admin(Entity): |
| 11 | + """Entity that acts as a container for administrator functionality.""" |
| 12 | + |
| 13 | + @property |
| 14 | + def microsoft365_apps(self): |
| 15 | + """A container for the Microsoft 365 apps admin functionality.""" |
| 16 | + return self.properties.get( |
| 17 | + "microsoft365Apps", |
| 18 | + AdminMicrosoft365Apps( |
| 19 | + self.context, ResourcePath("microsoft365Apps", self.resource_path) |
| 20 | + ), |
| 21 | + ) |
| 22 | + |
| 23 | + @property |
| 24 | + def sharepoint(self): |
| 25 | + """A container for administrative resources to manage tenant-level settings for SharePoint and OneDrive.""" |
| 26 | + return self.properties.get( |
| 27 | + "sharepoint", |
| 28 | + Sharepoint(self.context, ResourcePath("sharepoint", self.resource_path)), |
| 29 | + ) |
| 30 | + |
| 31 | + @property |
| 32 | + def service_announcement(self): |
| 33 | + """A container for service communications resources. Read-only.""" |
| 34 | + return self.properties.get( |
| 35 | + "serviceAnnouncement", |
| 36 | + ServiceAnnouncement( |
| 37 | + self.context, ResourcePath("serviceAnnouncement", self.resource_path) |
| 38 | + ), |
| 39 | + ) |
| 40 | + |
| 41 | + @property |
| 42 | + def report_settings(self): |
| 43 | + """A container for administrative resources to manage reports.""" |
| 44 | + return self.properties.get( |
| 45 | + "reportSettings", |
| 46 | + AdminReportSettings( |
| 47 | + self.context, ResourcePath("reportSettings", self.resource_path) |
| 48 | + ), |
| 49 | + ) |
| 50 | + |
| 51 | + @property |
| 52 | + def people(self): |
| 53 | + """Represents a setting to control people-related admin settings in the tenant.""" |
| 54 | + return self.properties.get( |
| 55 | + "people", |
| 56 | + PeopleAdminSettings( |
| 57 | + self.context, ResourcePath("people", self.resource_path) |
| 58 | + ), |
| 59 | + ) |
| 60 | + |
| 61 | + def get_property(self, name, default_value=None): |
| 62 | + if default_value is None: |
| 63 | + property_mapping = { |
| 64 | + "microsoft365Apps": self.microsoft365_apps, |
| 65 | + "serviceAnnouncement": self.service_announcement, |
| 66 | + "reportSettings": self.report_settings, |
| 67 | + } |
| 68 | + default_value = property_mapping.get(name, None) |
| 69 | + return super(Admin, self).get_property(name, default_value) |
0 commit comments