Example #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()
Example #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()
 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()
 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()
Example #5
0
    def stop(self):
        """
        Stops the ArcGIS Service.
        """

        send_session_request(
            self._session,
            requests.Request("POST", "{0}/stop".format(self._url_full)))
Example #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()
Example #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()
Example #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"]]
Example #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()
 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"]]
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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
Example #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
Example #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
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #27
0
    def stop(self):
        """
        Stops the ArcGIS Service.
        """

        send_session_request(self._session, requests.Request("POST", "{0}/stop".format(self._url_full)))
Example #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()
Example #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()