def getContentTypeUids(folder): ''' Creates a list with all content type uids ''' path = config.defineFullFolderPath(folder, 'contentTypes') ctArr = [] for ct in path: ctArr.append(ct.strip('json')) return ctArr
def exportRoles(apiKey, token, region, folder): ''' Exporting Roles ''' config.logging.info('Exporting All Roles') folderPath = config.defineFullFolderPath(folder, 'roles') rolesExport = cma.getAllRoles(apiKey, token, region) if rolesExport: return writeExport(rolesExport['roles'], folderPath, 'name') config.logging.info('{}Missing role response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportLabels(apiKey, token, region, folder): ''' Exporting Labels ''' config.logging.info('Exporting all labels') folderPath = config.defineFullFolderPath(folder, 'labels') labelsExport = cma.getAllLabels(apiKey, token, region) if labelsExport: return writeExport(labelsExport['labels'], folderPath, 'name') config.logging.info('{}Missing label response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportExtensions(apiKey, token, region, folder): ''' Exporting Extensions ''' config.logging.info('Exporting extensions') folderPath = config.defineFullFolderPath(folder, 'extensions') extensionsExport = cma.getAllExtensions(apiKey, token, region) if extensionsExport: return writeExport(extensionsExport['extensions'], folderPath, 'title') config.logging.info( '{}Missing extensions response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportWebhooks(apiKey, token, region, folder): ''' Exporting Webhooks ''' config.logging.info('Exporting All Webhooks') folderPath = config.defineFullFolderPath(folder, 'webhooks') webhooksExport = cma.getAllWebhooks(apiKey, token, region) if webhooksExport: return writeExport(webhooksExport['webhooks'], folderPath, 'name') config.logging.info( '{}Missing webhook response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportDeliveryTokens(apiKey, token, region, folder): ''' Exporting Delivery Tokens ''' config.logging.info('Exporting All Delivery Tokens') folderPath = config.defineFullFolderPath(folder, 'deliveryTokens') deliveryTokensExport = cma.getAllDeliveryTokens(apiKey, token, region) if deliveryTokensExport: return writeExport(deliveryTokensExport['tokens'], folderPath, 'name') config.logging.info( '{}Missing delivery token response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportGlobalFields(apiKey, token, region, folder): ''' Exporting global fields ''' config.logging.info('Exporting global fields') folderPath = config.defineFullFolderPath(folder, 'globalFields') globalFieldsExport = cma.getAllGlobalFields(apiKey, token, region) if globalFieldsExport: return writeExport(globalFieldsExport['global_fields'], folderPath, 'uid') config.logging.info( '{}Missing global field response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportContentTypes(apiKey, token, region, folder): ''' Exporting content types with global fields schema ''' config.logging.info('Exporting content types') folderPath = config.defineFullFolderPath(folder, 'contentTypes') contentTypesExport = cma.getAllContentTypes(apiKey, token, region) if contentTypesExport: return writeExport(contentTypesExport['content_types'], folderPath, 'uid') config.logging.info( '{}Missing content type response from Contentstack. Do you have content types in that stack?{}' .format(config.YELLOW, config.END)) return False
def exportEnvironments(apiKey, token, region, folder): ''' Exporting Environments ''' config.logging.info('Exporting All Environments') folderPath = config.defineFullFolderPath(folder, 'environments') environmentsExport = cma.getAllEnvironments(apiKey, token, region) if environmentsExport: return writeExport(environmentsExport['environments'], folderPath, 'name') config.logging.info( '{}Missing environment response from Contentstack.{}'.format( config.YELLOW, config.END)) return False
def exportPublishingRules(contentTypeUids, apiKey, token, region, folder): ''' Exporting publishing rules ''' config.logging.info('Exporting all publishing rules') folderPath = config.defineFullFolderPath(folder, 'publishingRules') publishingRulesExport = cma.getAllPublishingRules(contentTypeUids, apiKey, token, region) if publishingRulesExport: return writeExport(publishingRulesExport['publishing_rules'], folderPath, 'uid') config.logging.info( '{}Missing publishing rule response from Contentstack.{}'.format( config.YELLOW, config.END)) return False