def register_certificate(cls,out_path,csr_path,type): csr = Certificate.get_certSigningRequest(path=csr_path) result = ConnectManager().register_certificate(ConnectApi.connect_api_certificates.value[0],csr,type=type) if result['status'] == 201: res = result["data"]['data'] file_path = os.path.join(out_path,res['id']+'.cer') decode_content = connectool.base64decode(res['attributes']['certificateContent']) connectool.saveByteFile(decode_content,file_path) return {'status':200,'path':file_path,'data':result['data']} return result
def download_profiles(cls, outpath, limit, sort): result = Profile.list_profiles(limit, sort) if result['status'] == 200: array = result['data']['data'] for cert_obj in array: encodeStr = cert_obj['attributes']['profileContent'] decodeStr = connectool.base64decode(encodeStr) filename = cert_obj['attributes']['name'] + '.mobileprovision' connectool.saveByteFile(decodeStr, os.path.join(outpath, str(filename))) return result
def create_profile(cls, name, bundle_id, certificate_id, devices, type, out_path): result = ConnectManager().create_profile( ConnectApi.connect_api_profiles.value[0], name=name, bundle_id=bundle_id, cerificate_id=certificate_id, devices=devices, type=type) if result['status'] == 201: res = result['data']['data']['attributes'] path = os.path.join(out_path, res['name'] + '.mobileprovision') decode_content = connectool.base64decode(res['profileContent']) connectool.saveByteFile(decode_content, path) return { 'status': 200, 'data': result['data']['data'], 'path': path } return result