def setUp(self): self.connection = Connection('127.0.0.1') self.connection._access_token = "123456789" self.policies = policies.Policies(self.connection) self.clusters = clusters.OmnistackClusters(self.connection) self.hosts = hosts.Hosts(self.connection) self.cluster_groups = cluster_groups.ClusterGroups(self.connection)
def set_retention(self, backups, retention, force=False, cluster_group=None, timeout=-1): """Sets the retention time for the specified list of backups. Args: backups: The list of backup objects that you want to set the retention time for. retention: The number of minutes to keep backups. force: An indicator to force a retention time modification even if this action results in deleting backups. Valid Values: True: Sets the new retention time for the specified list of backups. This action may delete of one or more backups. False: Does not make the requested retention time modification if this results in deleting one or more backups. This operation returns a list of backups that the requested modification deletes. If the requested modification does not delete the backups, the retention time modification occurs. cluster_group: Object/name of the cluster group. timeout: Time out for the request in seconds. Returns: list: List of backup objects. """ method_url = "{}/set_retention".format(URL) backup_ids = [backup.data["id"] for backup in backups] data = {"backup_id": backup_ids, "retention": retention, "force": force} if cluster_group: if not isinstance(cluster_group, cluster_groups.ClusterGroup): # if passed by cluster_group name cluster_group = cluster_groups.ClusterGroups(self._connection).get_by_name(cluster_group) cluster_group_id = cluster_group.data["id"] data["cluster_group_id"] = cluster_group_id self._client.do_post(method_url, data, timeout) comma_separated_ids = ','.join(backup_ids) return self.get_all(filters={'id': comma_separated_ids})
def setUp(self): self.connection = Connection('127.0.0.1') self.connection._access_token = "123456789" self.backups = backups.Backups(self.connection) self.datastores = datastores.Datastores(self.connection) self.virtual_machines = virtual_machines.VirtualMachines(self.connection) self.clusters = omnistack_clusters.OmnistackClusters(self.connection) self.cluster_groups = cluster_groups.ClusterGroups(self.connection)
def setUp(self): self.connection = Connection('127.0.0.1') self.connection._access_token = "123456789" self.cluster_groups = cluster_groups.ClusterGroups(self.connection)