Docs: generate types for pipeline entity. (#1028)

This commit is contained in:
Sachin Chaurasiya 2021-11-02 16:22:27 +05:30 committed by GitHub
parent 6f90019967
commit 15d4c66f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 88 additions and 371 deletions

View File

@ -1,5 +1,5 @@
import { AxiosResponse } from 'axios';
import { Task } from '../generated/entity/data/task';
import { Task } from '../generated/entity/data/pipeline';
import { getURLWithQueryFields } from '../utils/APIUtils';
import APIClient from './index';

View File

@ -64,7 +64,7 @@ export interface CreatePipeline {
/**
* All the tasks that are part of pipeline.
*/
tasks?: EntityReference[];
tasks?: Task[];
}
/**
@ -152,3 +152,45 @@ export enum State {
Confirmed = 'Confirmed',
Suggested = 'Suggested',
}
export interface Task {
/**
* Description of this Task.
*/
description?: string;
/**
* Display Name that identifies this Task. It could be title or label from the pipeline
* services.
*/
displayName?: string;
/**
* All the tasks that are downstream of this task.
*/
downstreamTasks?: string[];
/**
* A unique name that identifies a pipeline in the format
* 'ServiceName.PipelineName.TaskName'.
*/
fullyQualifiedName?: string;
/**
* Name that identifies this task instance uniquely.
*/
name: string;
/**
* Tags for this task.
*/
tags?: TagLabel[];
/**
* SQL used in the task. Can be used to determine the lineage.
*/
taskSQL?: string;
/**
* Type of the Task. Usually refers to the class it implements.
*/
taskType?: string;
/**
* Task URL to visit/manage. This URL points to respective pipeline service UI.
*/
taskUrl?: string;
id: any;
}

View File

@ -1,158 +0,0 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Create Task entity request
*/
export interface CreateTask {
/**
* Description of the task instance. What it has and how to use it.
*/
description?: string;
/**
* Display Name that identifies this Task. It could be title or label from the pipeline
* services
*/
displayName?: string;
/**
* All the tasks that are downstream of this task.
*/
downstreamTasks?: string[];
/**
* End date of the task
*/
endDate?: Date;
/**
* Name that identifies this Task.
*/
name: string;
/**
* Owner of this Task
*/
owner?: EntityReference;
/**
* Link to the pipeline service where this task is used
*/
service: EntityReference;
/**
* Start date of the task
*/
startDate?: Date;
/**
* Tags for this chart
*/
tags?: TagLabel[];
/**
* SQL used in the task. Can be used to determine the lineage
*/
taskSQL?: string;
/**
* Type of the Task. Usually refers to the class it implements
*/
taskType?: string;
/**
* Task URL to visit/manage. This URL points to respective pipeline service UI
*/
taskUrl?: string;
}
/**
* Owner of this Task
*
* This schema defines the EntityReference type used for referencing an entity.
* EntityReference is used for capturing relationships from one entity to another. For
* example, a table has an attribute called database of type EntityReference that captures
* the relationship of a table `belongs to a` database.
*
* Link to the pipeline service where this task is used
*/
export interface EntityReference {
/**
* Optional description of entity.
*/
description?: string;
/**
* Display Name that identifies this entity.
*/
displayName?: string;
/**
* Link to the entity resource.
*/
href?: string;
/**
* Unique identifier that identifies an entity instance.
*/
id: string;
/**
* Name of the entity instance. For entities such as tables, databases where the name is not
* unique, fullyQualifiedName is returned in this field.
*/
name?: string;
/**
* Entity type/class name - Examples: `database`, `table`, `metrics`, `redshift`, `mysql`,
* `bigquery`, `snowflake`...
*/
type: string;
}
/**
* This schema defines the type for labeling an entity with a Tag.
*/
export interface TagLabel {
/**
* Link to the tag resource.
*/
href?: string;
/**
* Label type describes how a tag label was applied. 'Manual' indicates the tag label was
* applied by a person. 'Derived' indicates a tag label was derived using the associated tag
* relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label
* was propagated from upstream based on lineage. 'Automated' is used when a tool was used
* to determine the tag label.
*/
labelType?: LabelType;
/**
* 'Suggested' state is used when a tag label is suggested by users or tools. Owner of the
* entity must confirm the suggested labels before it is marked as 'Confirmed'.
*/
state?: State;
tagFQN?: string;
}
/**
* Label type describes how a tag label was applied. 'Manual' indicates the tag label was
* applied by a person. 'Derived' indicates a tag label was derived using the associated tag
* relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label
* was propagated from upstream based on lineage. 'Automated' is used when a tool was used
* to determine the tag label.
*/
export enum LabelType {
Automated = 'Automated',
Derived = 'Derived',
Manual = 'Manual',
Propagated = 'Propagated',
}
/**
* 'Suggested' state is used when a tag label is suggested by users or tools. Owner of the
* entity must confirm the suggested labels before it is marked as 'Confirmed'.
*/
export enum State {
Confirmed = 'Confirmed',
Suggested = 'Suggested',
}

View File

@ -86,7 +86,7 @@ export interface Pipeline {
/**
* All the tasks that are part of pipeline.
*/
tasks?: EntityReference[];
tasks?: Task[];
/**
* Last update time corresponding to the new version of the entity.
*/
@ -209,3 +209,45 @@ export enum State {
Confirmed = 'Confirmed',
Suggested = 'Suggested',
}
export interface Task {
/**
* Description of this Task.
*/
description?: string;
/**
* Display Name that identifies this Task. It could be title or label from the pipeline
* services.
*/
displayName?: string;
/**
* All the tasks that are downstream of this task.
*/
downstreamTasks?: string[];
/**
* A unique name that identifies a pipeline in the format
* 'ServiceName.PipelineName.TaskName'.
*/
fullyQualifiedName?: string;
/**
* Name that identifies this task instance uniquely.
*/
name: string;
/**
* Tags for this task.
*/
tags?: TagLabel[];
/**
* SQL used in the task. Can be used to determine the lineage.
*/
taskSQL?: string;
/**
* Type of the Task. Usually refers to the class it implements.
*/
taskType?: string;
/**
* Task URL to visit/manage. This URL points to respective pipeline service UI.
*/
taskUrl?: string;
id: any;
}

View File

@ -1,208 +0,0 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This schema defines the Task entity. A task is a unit of computation in a Pipeline.
*/
export interface Task {
/**
* Change that lead to this version of the entity.
*/
changeDescription?: ChangeDescription;
/**
* Description of this Task.
*/
description?: string;
/**
* Display Name that identifies this Task. It could be title or label from the pipeline
* services.
*/
displayName?: string;
/**
* All the tasks that are downstream of this task.
*/
downstreamTasks?: string[];
/**
* End date of the task.
*/
endDate?: Date;
/**
* A unique name that identifies a pipeline in the format
* 'ServiceName.PipelineName.TaskName'.
*/
fullyQualifiedName?: string;
/**
* Link to the resource corresponding to this entity.
*/
href?: string;
/**
* Unique identifier that identifies a task instance.
*/
id: string;
/**
* Name that identifies this task instance uniquely.
*/
name: string;
/**
* Owner of this pipeline.
*/
owner?: EntityReference;
/**
* Link to service where this pipeline is hosted in.
*/
service: EntityReference;
/**
* Start date of the task.
*/
startDate?: Date;
/**
* Tags for this Pipeline.
*/
tags?: TagLabel[];
/**
* SQL used in the task. Can be used to determine the lineage.
*/
taskSQL?: string;
/**
* Type of the Task. Usually refers to the class it implements.
*/
taskType?: string;
/**
* Task URL to visit/manage. This URL points to respective pipeline service UI.
*/
taskUrl?: string;
/**
* Last update time corresponding to the new version of the entity.
*/
updatedAt?: Date;
/**
* User who made the update.
*/
updatedBy?: string;
/**
* Metadata version of the entity.
*/
version?: number;
}
/**
* Change that lead to this version of the entity.
*
* Description of the change.
*/
export interface ChangeDescription {
/**
* Fields added during the version changes.
*/
fieldsAdded?: string[];
/**
* Fields deleted during the version changes.
*/
fieldsDeleted?: string[];
/**
* Fields modified during the version changes.
*/
fieldsUpdated?: string[];
previousVersion?: number;
}
/**
* Owner of this pipeline.
*
* This schema defines the EntityReference type used for referencing an entity.
* EntityReference is used for capturing relationships from one entity to another. For
* example, a table has an attribute called database of type EntityReference that captures
* the relationship of a table `belongs to a` database.
*
* Link to service where this pipeline is hosted in.
*/
export interface EntityReference {
/**
* Optional description of entity.
*/
description?: string;
/**
* Display Name that identifies this entity.
*/
displayName?: string;
/**
* Link to the entity resource.
*/
href?: string;
/**
* Unique identifier that identifies an entity instance.
*/
id: string;
/**
* Name of the entity instance. For entities such as tables, databases where the name is not
* unique, fullyQualifiedName is returned in this field.
*/
name?: string;
/**
* Entity type/class name - Examples: `database`, `table`, `metrics`, `redshift`, `mysql`,
* `bigquery`, `snowflake`...
*/
type: string;
}
/**
* This schema defines the type for labeling an entity with a Tag.
*/
export interface TagLabel {
/**
* Link to the tag resource.
*/
href?: string;
/**
* Label type describes how a tag label was applied. 'Manual' indicates the tag label was
* applied by a person. 'Derived' indicates a tag label was derived using the associated tag
* relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label
* was propagated from upstream based on lineage. 'Automated' is used when a tool was used
* to determine the tag label.
*/
labelType?: LabelType;
/**
* 'Suggested' state is used when a tag label is suggested by users or tools. Owner of the
* entity must confirm the suggested labels before it is marked as 'Confirmed'.
*/
state?: State;
tagFQN?: string;
}
/**
* Label type describes how a tag label was applied. 'Manual' indicates the tag label was
* applied by a person. 'Derived' indicates a tag label was derived using the associated tag
* relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label
* was propagated from upstream based on lineage. 'Automated' is used when a tool was used
* to determine the tag label.
*/
export enum LabelType {
Automated = 'Automated',
Derived = 'Derived',
Manual = 'Manual',
Propagated = 'Propagated',
}
/**
* 'Suggested' state is used when a tag label is suggested by users or tools. Owner of the
* entity must confirm the suggested labels before it is marked as 'Confirmed'.
*/
export enum State {
Confirmed = 'Confirmed',
Suggested = 'Suggested',
}

View File

@ -32,8 +32,7 @@ import {
getTeamDetailsPath,
} from '../../constants/constants';
import { EntityType } from '../../enums/entity.enum';
import { Pipeline } from '../../generated/entity/data/pipeline';
import { Task } from '../../generated/entity/data/task';
import { Pipeline, Task } from '../../generated/entity/data/pipeline';
import { User } from '../../generated/entity/teams/user';
import { EntityLineage } from '../../generated/type/entityLineage';
import { TagLabel } from '../../generated/type/tagLabel';