def add_rados_gateway(self, *args, **kwargs): banner("PCC.Rados Gateway Create") self._load_kwargs(kwargs) print("Kwargs:" + str(kwargs)) try: conn = BuiltIn().get_variable_value("${PCC_CONN}") except Exception as e: raise e if self.cephPoolID == None: self.cephPoolID = easy.get_ceph_pool_id_by_name( conn, self.poolName) if self.certificateID == None: self.certificateID = easy.get_certificate_id_by_name( conn, self.certificateName) if self.port: self.port = ast.literal_eval(str(self.port)) if self.S3Accounts != None or self.S3Accounts != []: tmp_cert = {} for cert in eval(str(self.S3Accounts)): cert_id = easy.get_metadata_profile_id_by_name(conn, cert) tmp_cert[str(cert_id)] = {} self.S3Accounts = tmp_cert tmp_node = [] if self.targetNodes != [] or self.targetNodes != '': for node_name in eval(str(self.targetNodes)): print("Node Name:" + str(node_name)) node_id = easy.get_node_id_by_name(conn, node_name) print("Node Id:" + str(node_id)) tmp_node.append(node_id) print("Node List:" + str(tmp_node)) self.targetNodes = tmp_node if self.service_ip.lower() == "yes": serviceIpType = "NodeIp" else: serviceIpType = "Default" payload = { "name": self.name, "cephPoolID": self.cephPoolID, "targetNodes": self.targetNodes, "port": self.port, "certificateID": self.certificateID, "S3Accounts": self.S3Accounts, "serviceIpType": serviceIpType } print("Payload:-" + str(payload)) return pcc.add_ceph_rgw(conn, payload)
def get_certificate_id(self, *args, **kwargs): """ Get Certificate Id [Args] (str) Alias [Returns] (dict) Get Certificate Id """ self._load_kwargs(kwargs) banner("Kwargs are: {}".format(kwargs)) banner("PCC.Get Certificate Id [Alias=%s]" % self.Alias) conn = BuiltIn().get_variable_value("${PCC_CONN}") return easy.get_certificate_id_by_name(conn, Name = self.Alias)
def delete_certificate(self, *args, **kwargs): """ Delete Certificate [Args] (str) Alias [Returns] (dict) Delete Certificate Response """ self._load_kwargs(kwargs) banner("Kwargs are: {}".format(kwargs)) banner("PCC.Delete Certificate [Alias=%s]" % self.Alias) conn = BuiltIn().get_variable_value("${PCC_CONN}") certificate_id = easy.get_certificate_id_by_name(conn, Name = self.Alias) banner("Certificate id is: {}".format(certificate_id)) return pcc.delete_certificate_by_id(conn, id=str(certificate_id))