Skip to content

Commit

Permalink
122 automate building jazz settings for everysite (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
LivCurtis authored Oct 7, 2024
1 parent e66f78d commit 45bd8ce
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
49 changes: 49 additions & 0 deletions odins_spear/methods/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@ def session_switch(self, username: str):

#ACCOUNT AUTHORIZATION CODES
#ADMINISTRATORS

def group_admin(self, service_provider_id: str, group_id: str, user_id: str, password: str, payload: dict = {}):
"""Builds a group-level administrator.
Args:
service_provider_id (str): Service provider ID where the admin should be built.
group_id (str): Group ID where the admin should be built
user_id (str): User ID of the admin.
password (str): Password for the administrator profile. Note get.password_generate() can be used to get this.
payload (dict, optional): Admin configuration data.
Returns:
Dict: Returns the device profile.
"""

endpoint = "/groups/admins"

payload["serviceProviderId"] = service_provider_id
payload["groupId"] = group_id
payload["userId"] = user_id
payload["password"] = password

return self.requester.post(endpoint, data=payload)


#ADVICE OF CHARGE
#ALTERNATE NUMBERS
#ANSWER CONFIRMATION
Expand Down Expand Up @@ -255,6 +280,30 @@ def service_provider_dns(self, service_provider_id: str, start_of_range_number:
#DOMAINS
#EMERGENCY NOTIFICATIONS
#EMERGENCY ZONES

def group_emergency_zones(self, service_provider_id: str, group_id: str, ip_addresses: list):
"""Updates the IP address(es) for the Emergency Zone configured in the group.
Args:
service_provider_id (str): Service provider ID where the Emergency Zone to be updated exists.
group_id (str): Group ID where the Emergency Zone to be updated exists.
ip_addresses (list): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same.
Returns:
Dict: Emergency Zone profile with updated IP addresses.
"""

endpoint = "/groups/emergency-zones"

data = {
"serviceProviderId": service_provider_id,
"groupId": group_id,
"ipAddresses": ip_addresses
}

return self.requester.post(endpoint, data=data)


#ENTERPRISE TRUNKS
#EXECUTIVE
#EXECUTIVE ASSISTANT
Expand Down
36 changes: 36 additions & 0 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,42 @@ def user_do_not_disturb(self, user_id: str, dnd_active: bool = False, ring_splas
#DOMAINS
#EMERGENCY NOTIFICATIONS
#EMERGENCY ZONES

def group_emergency_zones(self, service_provider_id: str, group_id: str, is_active: bool=True, zone_rules: str=None, emergency_notification_email: str=None, ip_addresses: list=None):
"""Updates the Emergency Zone configuration in the group.
Args:
service_provider_id (str): Service provider ID where the Emergency Zone to be updated exists.
group_id (str): Group ID where the Emergency Zone to be updated exists.
is_active (bool, optional): Whether the Emergency Zone service is active or not. Defaults to True
zone_rules (str, optional): The rules of the Emergency Zone. This will either be "Prohibit all registrations and call originations" or "Prohibit emergency call originations".
emergency_notification_email (str, optional): The email address where emergency call notifications should be sent.
ip_addresses (list, optional): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same.
Returns:
Dict: Updated Emergency Zone configuration.
"""

endpoint = "/groups/emergency-zones"

data = {
"groupId": group_id,
"serviceProviderId": service_provider_id
}

if is_active:
data["isActive"] = is_active
if zone_rules:
data["emergencyZonesProhibition"] = zone_rules
if emergency_notification_email:
data["sendEmergencyCallNotifyEmail"] = True
data["emergencyCallNotifyEmailAddress"] = emergency_notification_email
if ip_addresses:
data["ipAddresses"] = ip_addresses

return self.requester.put(endpoint, data)


#ENTERPRISE TRUNKS
#EXECUTIVE
#EXECUTIVE ASSISTANT
Expand Down

0 comments on commit 45bd8ce

Please sign in to comment.