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()
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 stop(self): """ Stops the ArcGIS Service. """ send_session_request( self._session, requests.Request("POST", "{0}/stop".format(self._url_full)))
def start_service(self): """ Starts the ArcGIS Service. """ return send_session_request( self._session, self._create_operation_request(self._url_full, "start")).json()
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()
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"]]
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_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()
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()
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()
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()
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 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
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
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
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()
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()
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()
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()
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()
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()
def stop(self): """ Stops the ArcGIS Service. """ send_session_request(self._session, requests.Request("POST", "{0}/stop".format(self._url_full)))
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()
def start_service(self): """ Starts the ArcGIS Service. """ return send_session_request(self._session, self._create_operation_request(self._url_full, "start")).json()