def get(
     self,
     activegate_id: str,
     time_from: Optional[Union[datetime, str]] = None,
     time_to: Optional[Union[datetime, str]] = None,
     start_version_compare_type: Optional[Union[str,
                                                VersionCompareType]] = None,
     start_version: Optional[str] = None,
     update_type: Optional[Union[str, UpdateType]] = None,
     target_version_compare_type: Optional[Union[
         str, VersionCompareType]] = None,
     target_version: Optional[str] = None,
 ) -> "UpdateJobList":
     params = {
         "from": timestamp_to_string(time_from),
         "to": timestamp_to_string(time_to),
         "startVersionCompareType": start_version_compare_type,
         "startVersion": start_version,
         "updateType": update_type,
         "targetVersionCompareType": target_version_compare_type,
         "targetVersion": target_version,
     }
     return UpdateJobList(raw_element=self.__http_client.make_request(
         f"/api/v2/activeGates/{activegate_id}/updateJobs",
         params=params).json())
 def list(
     self,
     time_from: Optional[Union[datetime, str]] = None,
     time_to: Optional[Union[datetime, str]] = None,
     start_version_compare_type: Optional[Union[str,
                                                VersionCompareType]] = None,
     start_version: Optional[str] = None,
     update_type: Optional[Union[str, UpdateType]] = None,
     target_version_compare_type: Optional[Union[
         str, VersionCompareType]] = None,
     target_version: Optional[str] = None,
 ) -> PaginatedList["UpdateJobList"]:
     params = {
         "from": timestamp_to_string(time_from),
         "to": timestamp_to_string(time_to),
         "startVersionCompareType": start_version_compare_type,
         "startVersion": start_version,
         "updateType": update_type,
         "targetVersionCompareType": target_version_compare_type,
         "targetVersion": target_version,
     }
     return PaginatedList(UpdateJobList,
                          self.__http_client,
                          f"/api/v2/activeGates/updateJobs",
                          list_item="allUpdateJobs",
                          target_params=params)
Esempio n. 3
0
 def list(
     self,
     entity_selector: str,
     time_from: Optional[Union[datetime, str]] = None,
     time_to: Optional[Union[datetime, str]] = None,
     fields: Optional[str] = None,
     sort: Optional[str] = None,
     page_size: Optional[int] = None,
 ) -> PaginatedList["Entity"]:
     """
     :return: A list of monitored entities along with their properties.
     """
     params = {
         "pageSize": page_size,
         "entitySelector": entity_selector,
         "from": timestamp_to_string(time_from),
         "to": timestamp_to_string(time_to),
         "fields": fields,
         "sort": sort,
     }
     return PaginatedList(Entity,
                          self.__http_client,
                          "/api/v2/entities",
                          target_params=params,
                          list_item="entities")
Esempio n. 4
0
 def get(self,
         entity_id: str,
         time_from: Optional[Union[datetime, str]] = None,
         time_to: Optional[Union[datetime, str]] = None,
         fields: Optional[str] = None) -> "Entity":
     params = {
         "from": timestamp_to_string(time_from),
         "to": timestamp_to_string(time_to),
         "fields": fields
     }
     response = self.__http_client.make_request(
         f"/api/v2/entities/{entity_id}", params=params).json()
     return Entity(raw_element=response)
Esempio n. 5
0
 def list(
     self,
     log_filter: Optional[str] = None,
     time_from: Optional[Union[datetime, str]] = None,
     time_to: Optional[Union[datetime, str]] = None,
     sort: Optional[str] = None,
 ) -> PaginatedList["AuditLogEntry"]:
     params = {
         "filter": log_filter,
         "from": timestamp_to_string(time_from),
         "to": timestamp_to_string(time_to),
         "sort": sort
     }
     return PaginatedList(target_class=AuditLogEntry,
                          http_client=self.__http_client,
                          target_url="/api/v2/auditlogs",
                          target_params=params,
                          list_item="auditLogs")
Esempio n. 6
0
    def list(
        self,
        api_token_selector: Optional[str] = None,
        fields: Optional[str] = None,
        time_from: Optional[Union[str, datetime]] = None,
        time_to: Optional[Union[str, datetime]] = None,
        sort: Optional[str] = None,
    ) -> PaginatedList["ApiToken"]:

        params = {
            "apiTokenSelector": api_token_selector,
            "fields": fields,
            "from": timestamp_to_string(time_from),
            "to": timestamp_to_string(time_to),
            "sort": sort,
        }

        return PaginatedList(ApiToken, self.__http_client, "/api/v2/apiTokens", params, list_item="apiTokens")
Esempio n. 7
0
    def query(
        self,
        metric_selector: str,
        resolution: str = None,
        time_from: Optional[Union[datetime, str]] = None,
        time_to: Optional[Union[datetime, str]] = None,
        entity_selector: Optional[str] = None,
    ) -> PaginatedList["MetricSeriesCollection"]:

        params = {
            "metricSelector": metric_selector,
            "resolution": resolution,
            "from": timestamp_to_string(time_from),
            "to": timestamp_to_string(time_to),
            "entitySelector": entity_selector,
        }
        return PaginatedList(MetricSeriesCollection,
                             self.__http_client,
                             "/api/v2/metrics/query",
                             params,
                             list_item="result")
Esempio n. 8
0
 def list(
     self,
     metric_selector: Optional[str] = None,
     text: Optional[str] = None,
     fields: Optional[str] = None,
     written_since: Optional[Union[str, datetime]] = None,
     metadata_selector: Optional[str] = None,
     page_size=100,
 ) -> PaginatedList["MetricDescriptor"]:
     params = {
         "pageSize": page_size,
         "metricSelector": metric_selector,
         "text": text,
         "fields": fields,
         "writtenSince": timestamp_to_string(written_since),
         "metadataSelector": metadata_selector,
     }
     return PaginatedList(MetricDescriptor,
                          self.__http_client,
                          "/api/v2/metrics",
                          params,
                          list_item="metrics")