def exports_get(export_id, output_path, quiet, format_): """ Get the details of an export. If you specify the `<output_path>` option, this location will be used to store the export details in a yaml file. You can either specify the `<output_path>` as file or directory. If the specified `<output_path>` is a directory, the settings will be stored in `export.yaml`. """ project_name = get_current_project(error=True) client = init_client() export = client.exports_get(project_name=project_name, export_id=export_id) client.api_client.close() if output_path is not None: dictionary = format_yaml( item=export, required_front=['id', 'deployments', 'pipelines', 'environment_variables'], as_str=False ) yaml_file = write_yaml(output_path, dictionary, default_file_name="export.yaml") if not quiet: click.echo('Export details are stored in: %s' % yaml_file) else: print_item(item=export, row_attrs=GET_ITEMS, fmt=format_)
def pipelines_get(pipeline_name, output_path, quiet, format_): """ Get the pipeline settings, like, input_type and input_fields. If you specify the <output_path> option, this location will be used to store the pipeline structure in a yaml file. You can either specify the <output_path> as file or directory. If the specified <output_path> is a directory, the settings will be stored in `pipeline.yaml`. """ project_name = get_current_project(error=True) client = init_client() pipeline = client.pipelines_get(project_name=project_name, pipeline_name=pipeline_name) client.api_client.close() if output_path is not None: dictionary = format_yaml( pipeline, required_front=['name', 'description', 'input_type'], optional=[ 'input_fields name', 'input_fields data_type', 'output_type', 'output_fields name', 'output_fields data_type' ], rename={ 'name': 'pipeline_name', 'description': 'pipeline_description' }, as_str=False) yaml_file = write_yaml(output_path, dictionary, default_file_name="pipeline.yaml") if not quiet: click.echo('Pipeline file is stored in: %s' % yaml_file) else: print_item(pipeline, row_attrs=LIST_ITEMS, required_front=['name', 'description', 'input_type'], optional=[ 'input_fields name', 'input_fields data_type', 'output_type', 'output_fields name', 'output_fields data_type', 'creation_date', 'last_updated', 'default_version' ], rename={ 'name': 'pipeline_name', 'description': 'pipeline_description' }, fmt=format_)
def deployments_get(deployment_name, output_path, quiet, format_): """ Get the deployment settings, like, input_type and output_type. If you specify the `<output_path>` option, this location will be used to store the deployment settings in a yaml file. You can either specify the `<output_path>` as file or directory. If the specified `<output_path>` is a directory, the settings will be stored in `deployment.yaml`. """ project_name = get_current_project(error=True) client = init_client() deployment = client.deployments_get(project_name=project_name, deployment_name=deployment_name) client.api_client.close() if output_path is not None: dictionary = format_yaml( item=deployment, required_front=['name', 'description', 'labels', 'input_type', 'output_type'], optional=['input_fields name', 'input_fields data_type', 'output_fields name', 'output_fields data_type'], rename={'name': 'deployment_name', 'description': 'deployment_description', 'labels': 'deployment_labels'}, as_str=False ) yaml_file = write_yaml(output_path, dictionary, default_file_name="deployment.yaml") if not quiet: click.echo('Deployment file is stored in: %s' % yaml_file) else: print_item( item=deployment, row_attrs=LIST_ITEMS, required_front=['id', 'name', 'project', 'description', 'labels', 'input_type', 'output_type'], optional=['input_fields name', 'input_fields data_type', 'output_fields name', 'output_fields data_type'], required_end=['creation_date', 'last_updated', 'default_version'], rename={'name': 'deployment_name', 'description': 'deployment_description', 'labels': 'deployment_labels'}, fmt=format_ )
def pipeline_versions_get(pipeline_name, version_name, output_path, quiet, format_): """ Get the pipeline version structure: input_type, version, objects and connections between the objects (attachments). If you specify the `<output_path>` option, this location will be used to store the pipeline version settings in a yaml file. You can either specify the `<output_path>` as file or directory. If the specified `<output_path>` is a directory, the settings will be stored in `version.yaml`. \b Example of yaml content: ``` pipeline_name: my-pipeline-name input_type: structured input_fields: - name: my-pipeline-param1 data_type: int output_type: structured output_fields: - name: my-pipeline-output1 data_type: int version_name: my-version-name version_description: Version created via command line. version_labels: my-key-1: my-label-1 my-key-2: my-label-2 request_retention_mode: none request_retention_time: 604800 objects: - name: object1 reference_name: my-deployment-name reference_version: my-deployment-version attachments: - destination_name: object1 sources: - source_name: pipeline_start mapping: - source_field_name: my-pipeline-param1 destination_field_name: my-deployment-param1 ``` """ project_name = get_current_project(error=True) # Get pipeline version structure - pipeline, objects and attachments details client = init_client() version = client.pipeline_versions_get(project_name=project_name, pipeline_name=pipeline_name, version=version_name) pipeline = client.pipelines_get(project_name=project_name, pipeline_name=pipeline_name) client.api_client.close() setattr(version, 'input_type', pipeline.input_type) setattr(version, 'input_fields', pipeline.input_fields) setattr(version, 'output_type', pipeline.output_type) setattr(version, 'output_fields', pipeline.output_fields) if output_path is not None: # Store only reusable settings dictionary = format_yaml( item=version, required_front=[ 'pipeline', 'input_type', 'input_fields', 'output_type', 'output_fields', 'version', *PIPELINE_VERSION_FIELDS ], optional=[ 'objects name', 'objects reference_name', 'objects version', 'attachments destination_name', 'attachments sources source_name', 'attachments sources mapping', 'input_fields name', 'input_fields data_type', 'output_fields name', 'output_fields data_type' ], rename={ 'pipeline': 'pipeline_name', 'version': 'version_name', 'objects version': 'reference_version', **PIPELINE_VERSION_FIELDS_RENAMED }, as_str=False) yaml_file = write_yaml(output_path, dictionary, default_file_name="pipeline_version.yaml") if not quiet: click.echo('Pipeline version file stored in: %s' % yaml_file) else: print_item(item=version, row_attrs=LIST_ITEMS, required_front=[ 'pipeline', 'input_type', 'input_fields', 'output_type', 'output_fields', 'version', *PIPELINE_VERSION_FIELDS ], optional=[ 'creation_date', 'last_updated', 'objects name', 'objects reference_name', 'objects version', 'attachments destination_name', 'attachments sources source_name', 'attachments sources mapping', 'input_fields name', 'input_fields data_type', 'output_fields name', 'output_fields data_type' ], rename={ 'creation_date': 'version_creation_date', 'last_updated': 'version_last_updated', 'pipeline': 'pipeline_name', 'version': 'version_name', 'objects version': 'reference_version', **PIPELINE_VERSION_FIELDS_RENAMED }, fmt=format_)
def versions_get(deployment_name, version_name, output_path, quiet, format_): """Get the version of a deployment. If you specify the `<output_path>` option, this location will be used to store the deployment version settings in a yaml file. You can either specify the `<output_path>` as file or directory. If the specified `<output_path>` is a directory, the settings will be stored in `version.yaml`. \b Example of yaml content: ``` deployment_name: my-deployment version_name: my-version version_description: Version created via command line. version_labels: my-key-1: my-label-1 my-key-2: my-label-2 language: python3.7 instance_type: 2048mb minimum_instances: 0 maximum_instances: 5 maximum_idle_time: 300 request_retention_mode: none request_retention_time: 604800 deployment_mode: express ``` """ project_name = get_current_project(error=True) # Show version details client = init_client() version = client.deployment_versions_get(project_name=project_name, deployment_name=deployment_name, version=version_name) client.api_client.close() if output_path is not None: # Store only reusable settings dictionary = format_yaml(item=version, required_front=[ 'version', 'deployment', *DEPLOYMENT_VERSION_FIELDS ], rename={ 'deployment': 'deployment_name', 'version': 'version_name', **DEPLOYMENT_VERSION_FIELDS_RENAMED }, as_str=False) yaml_file = write_yaml(output_path, dictionary, default_file_name="version.yaml") if not quiet: click.echo('Version file stored in: %s' % yaml_file) else: print_item(item=version, row_attrs=LIST_ITEMS, rename={ 'deployment': 'deployment_name', 'version': 'version_name', **DEPLOYMENT_VERSION_FIELDS_RENAMED }, fmt=format_)