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

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

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