Esempio n. 1
0
 def add_permission(self, principal):
     """
     Adds a user/role to the allowed principals list for an endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions/add")
     r.data = {"principal": principal, "isAllowed": True}
     send_session_request(self._session, r).json()
Esempio n. 2
0
 def remove_permission(self, principal):
     """
     Removes a user/role from the allowed principals list for an endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions/add")
     r.data = {"principal": principal, "isAllowed": False}
     send_session_request(self._session, r).json()
Esempio n. 3
0
 def remove_permission(self, principal):
     """
     Removes a user/role from the allowed principals list for an endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions/add")
     r.data = {"principal": principal, "isAllowed": False}
     send_session_request(self._session, r).json()
Esempio n. 4
0
 def add_permission(self, principal):
     """
     Adds a user/role to the allowed principals list for an endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions/add")
     r.data = {"principal": principal, "isAllowed": True}
     send_session_request(self._session, r).json()
Esempio n. 5
0
    def stop(self):
        """
        Stops the ArcGIS Service.
        """

        send_session_request(
            self._session,
            requests.Request("POST", "{0}/stop".format(self._url_full)))
Esempio n. 6
0
 def start_service(self):
     """
     Starts the ArcGIS Service.
     """
     return send_session_request(
         self._session,
         self._create_operation_request(self._url_full, "start")).json()
Esempio n. 7
0
 def get_status(self):
     """
     Gets the current status of the ArcGIS Service.
     """
     return send_session_request(
         self._session,
         self._create_operation_request(self._url_full, "status")).json()
Esempio n. 8
0
 def get_allowed_principals(self):
     """
     Gets a list of the allowed principals on the endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions")
     response = send_session_request(self._session, r).json()
     return [p["principal"] for p in response["permissions"]]
Esempio n. 9
0
 def get_properties(self):
     """
     Gets the properties of the service.
     """
     return send_session_request(
         self._requests_session,
         service_class._create_operation_request(self._url_full, method = "GET")).json()
Esempio n. 10
0
 def get_allowed_principals(self):
     """
     Gets a list of the allowed principals on the endpoint.
     """
     r = self._create_operation_request(self._url_full, "permissions")
     response = send_session_request(self._session, r).json()
     return [p["principal"] for p in response["permissions"]]
Esempio n. 11
0
 def get_iteminfo(self):
     """
     Gets the item info (description, summary, tags, etc.) of the service.
     """
     return send_session_request(
         self._session,
         self._create_operation_request(self._url_full, "iteminfo")).json()
Esempio n. 12
0
 def set_iteminfo(self, new_info):
     """
     Sets the item info (description, summary, tags, etc.) for the service.  Note that this will completely 
     overwrite the existing item info, so make sure all attributes are included.
     """
     r = self._create_operation_request(self._url_full, "iteminfo/edit")
     r.data = {"serviceItemInfo": dumps(new_info)}
     return send_session_request(self._session, r).json()
Esempio n. 13
0
 def set_iteminfo(self, new_info):
     """
     Sets the item info (description, summary, tags, etc.) for the service.  Note that this will completely 
     overwrite the existing item info, so make sure all attributes are included.
     """
     r = self._create_operation_request(self._url_full,  "iteminfo/edit")
     r.data = {"serviceItemInfo": dumps(new_info)}
     return send_session_request(self._session, r).json()
Esempio n. 14
0
 def get_statistics(self):
     """
     Gets statistics for the ArcGIS Service.
     """
     return send_session_request(
         self._session,
         self._create_operation_request(self._url_full,
                                        "statistics")).json()
Esempio n. 15
0
 def set_properties(self, new_properties):
     """
     Sets the properties of the service. Note that this will completely overwrite the existing service properties,
     so make sure all attributes are included.
     """
     r = self._create_operation_request(self._url_full, "edit")
     r.data = {"service": dumps(new_properties)}
     return send_session_request(self._session, r).json()
Esempio n. 16
0
 def set_properties(self, new_properties):
     """
     Sets the properties of the service. Note that this will completely overwrite the existing service properties,
     so make sure all attributes are included.
     """
     r = self._create_operation_request(self._url_full, "edit")
     r.data = {"service": dumps(new_properties)}
     return send_session_request(self._session, r).json()
Esempio n. 17
0
 def get_properties(self):
     """
     Gets the properties of the service.
     """
     return send_session_request(
         self._requests_session,
         service_class._create_operation_request(self._url_full,
                                                 method="GET")).json()
Esempio n. 18
0
    def set_properties(self, new_properties):
        """
        Sets the properties of the service. Note that this will completely overwrite the existing service properties,
        so make sure all attributes are included.
        """
        r = create_operation_request(
                    self._url_base, self.name, self._type, "edit", self.folder)
        r.data = {"service": dumps(new_properties)}
        response = send_session_request(self._session, r).json()

        #self._properties set after HTTP request incase exception is thrown
        self._properties = deepcopy(new_properties)
        return response
Esempio n. 19
0
 def get_services(self):
     """
     Gets a list of service proxy objects for services in this folder.
     """
     response = send_session_request(
         self._session,
         self._create_operation_request(self._url_full, method = "GET")).json()
         
     services = []
     for s in response["services"]:
         service_class = _get_service_class(s["type"])
         if service_class != None:
             services.append(service_class(self._session, self._url_base, s["serviceName"], s["folderName"]))
     
     return services
Esempio n. 20
0
    def get_services(self):
        """
        Gets a list of service proxy objects for services in this folder.
        """
        response = send_session_request(
            self._session,
            self._create_operation_request(self._url_full,
                                           method="GET")).json()

        services = []
        for s in response["services"]:
            service_class = _get_service_class(s["type"])
            if service_class != None:
                services.append(
                    service_class(self._session, self._url_base,
                                  s["serviceName"], s["folderName"]))

        return services
Esempio n. 21
0
 def get_iteminfo(self):
     """
     Gets the item info (description, summary, tags, etc.) of the service.
     """
     return send_session_request(self._session, create_operation_request(
                 self._url_base, self.name, self._type, "iteminfo", self.folder)).json()
Esempio n. 22
0
 def start_service(self):
     """
     Starts the ArcGIS Service.
     """
     return send_session_request(self._session, create_operation_request(
                 self._url_base, self.name, self._type, "start", self.folder)).json()
Esempio n. 23
0
 def get_iteminfo(self):
     """
     Gets the item info (description, summary, tags, etc.) of the service.
     """
     return send_session_request(self._session, self._create_operation_request(self._url_full, "iteminfo")).json()
Esempio n. 24
0
 def get_statistics(self):
     """
     Gets statistics for the ArcGIS Service.
     """
     return send_session_request(self._session, create_operation_request(
                 self._url_base, self.name, self._type, "statistics", self.folder)).json()
Esempio n. 25
0
 def get_status(self):
     """
     Gets the current status of the ArcGIS Service.
     """
     return send_session_request(self._session, create_operation_request(
                 self._url_base, self.name, self._type, "status", self.folder)).json()
Esempio n. 26
0
 def get_statistics(self):
     """
     Gets statistics for the ArcGIS Service.
     """
     return send_session_request(self._session, self._create_operation_request(self._url_full, "statistics")).json()
Esempio n. 27
0
    def stop(self):
        """
        Stops the ArcGIS Service.
        """

        send_session_request(self._session, requests.Request("POST", "{0}/stop".format(self._url_full)))
Esempio n. 28
0
 def get_status(self):
     """
     Gets the current status of the ArcGIS Service.
     """
     return send_session_request(self._session, self._create_operation_request(self._url_full, "status")).json()
Esempio n. 29
0
 def start_service(self):
     """
     Starts the ArcGIS Service.
     """
     return send_session_request(self._session, self._create_operation_request(self._url_full, "start")).json()