Skip to content

Commit

Permalink
Merge branch 'master' into restli-service-update
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker committed Dec 14, 2022
2 parents 9a95217 + 8c14dfc commit 921fe77
Show file tree
Hide file tree
Showing 254 changed files with 13,260 additions and 1,012 deletions.
7 changes: 3 additions & 4 deletions .github/actions/docker-custom-build-and-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ runs:
steps:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: ${{ inputs.images }}
# add git short SHA as Docker tag
tag-custom: ${{ inputs.tags }}
tag-custom-only: true

tags: |
type=raw,value=${{ inputs.tags }}
# Code for testing the build when not pushing to Docker Hub.
- name: Build and Load image for testing (if not publishing)
uses: docker/build-push-action@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
fetch-depth: 0
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
linkedin/datahub-ingestion
# add git short SHA as Docker tag
tag-custom: ${{ needs.setup.outputs.tag }}
tag-custom-only: true
tags: |
type=raw,value=${{ needs.setup.outputs.tag }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-postgres-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
fetch-depth: 0
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
acryldata/datahub-postgres-setup
# add git short SHA as Docker tag
tag-custom: ${{ needs.setup.outputs.tag }}
tag-custom-only: true
tags: |
type=raw,value=${{ needs.setup.outputs.tag }}
- name: Login to DockerHub
if: ${{ needs.setup.outputs.publish == 'true' }}
uses: docker/login-action@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
import com.linkedin.datahub.graphql.generated.CorpGroupInfo;
import com.linkedin.datahub.graphql.generated.CorpUser;
import com.linkedin.datahub.graphql.generated.CorpUserInfo;
import com.linkedin.datahub.graphql.generated.CorpUserViewsSettings;
import com.linkedin.datahub.graphql.generated.Dashboard;
import com.linkedin.datahub.graphql.generated.DashboardInfo;
import com.linkedin.datahub.graphql.generated.DashboardStatsSummary;
import com.linkedin.datahub.graphql.generated.DashboardUserUsageCounts;
import com.linkedin.datahub.graphql.generated.DataFlow;
import com.linkedin.datahub.graphql.generated.DataHubView;
import com.linkedin.datahub.graphql.generated.DataJob;
import com.linkedin.datahub.graphql.generated.DataJobInputOutput;
import com.linkedin.datahub.graphql.generated.DataPlatformInstance;
Expand All @@ -61,6 +63,7 @@
import com.linkedin.datahub.graphql.generated.ListDomainsResult;
import com.linkedin.datahub.graphql.generated.ListGroupsResult;
import com.linkedin.datahub.graphql.generated.ListTestsResult;
import com.linkedin.datahub.graphql.generated.ListViewsResult;
import com.linkedin.datahub.graphql.generated.MLFeature;
import com.linkedin.datahub.graphql.generated.MLFeatureProperties;
import com.linkedin.datahub.graphql.generated.MLFeatureTable;
Expand Down Expand Up @@ -176,6 +179,7 @@
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateNameResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateParentNodeResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateUserSettingResolver;
import com.linkedin.datahub.graphql.resolvers.settings.user.UpdateCorpUserViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.operation.ReportOperationResolver;
import com.linkedin.datahub.graphql.resolvers.policy.DeletePolicyResolver;
import com.linkedin.datahub.graphql.resolvers.policy.GetGrantedPrivilegesResolver;
Expand All @@ -196,6 +200,8 @@
import com.linkedin.datahub.graphql.resolvers.search.SearchResolver;
import com.linkedin.datahub.graphql.resolvers.step.BatchGetStepStatesResolver;
import com.linkedin.datahub.graphql.resolvers.step.BatchUpdateStepStatesResolver;
import com.linkedin.datahub.graphql.resolvers.settings.view.GlobalViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.settings.view.UpdateGlobalViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.tag.CreateTagResolver;
import com.linkedin.datahub.graphql.resolvers.tag.DeleteTagResolver;
import com.linkedin.datahub.graphql.resolvers.tag.SetTagColorResolver;
Expand All @@ -216,6 +222,11 @@
import com.linkedin.datahub.graphql.resolvers.user.ListUsersResolver;
import com.linkedin.datahub.graphql.resolvers.user.RemoveUserResolver;
import com.linkedin.datahub.graphql.resolvers.user.UpdateUserStatusResolver;
import com.linkedin.datahub.graphql.resolvers.view.CreateViewResolver;
import com.linkedin.datahub.graphql.resolvers.view.DeleteViewResolver;
import com.linkedin.datahub.graphql.resolvers.view.ListGlobalViewsResolver;
import com.linkedin.datahub.graphql.resolvers.view.ListMyViewsResolver;
import com.linkedin.datahub.graphql.resolvers.view.UpdateViewResolver;
import com.linkedin.datahub.graphql.types.BrowsableEntityType;
import com.linkedin.datahub.graphql.types.EntityType;
import com.linkedin.datahub.graphql.types.LoadableType;
Expand Down Expand Up @@ -252,17 +263,21 @@
import com.linkedin.datahub.graphql.types.schemafield.SchemaFieldType;
import com.linkedin.datahub.graphql.types.tag.TagType;
import com.linkedin.datahub.graphql.types.test.TestType;
import com.linkedin.datahub.graphql.types.view.DataHubViewType;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.config.DataHubConfiguration;
import com.linkedin.metadata.config.IngestionConfiguration;
import com.linkedin.metadata.config.TestsConfiguration;
import com.linkedin.metadata.config.ViewsConfiguration;
import com.linkedin.metadata.config.VisualConfiguration;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.graph.GraphClient;
import com.linkedin.metadata.graph.SiblingGraphService;
import com.linkedin.metadata.models.registry.EntityRegistry;
import com.linkedin.metadata.recommendation.RecommendationsService;
import com.linkedin.metadata.secret.SecretService;
import com.linkedin.metadata.service.SettingsService;
import com.linkedin.metadata.service.ViewService;
import com.linkedin.metadata.telemetry.TelemetryConfiguration;
import com.linkedin.metadata.timeline.TimelineService;
import com.linkedin.metadata.timeseries.TimeseriesAspectService;
Expand Down Expand Up @@ -322,6 +337,8 @@ public class GmsGraphQLEngine {
private final RoleService roleService;
private final InviteTokenService inviteTokenService;
private final PostService postService;
private final SettingsService settingsService;
private final ViewService viewService;

private final FeatureFlags featureFlags;

Expand All @@ -332,6 +349,7 @@ public class GmsGraphQLEngine {
private final TelemetryConfiguration telemetryConfiguration;
private final TestsConfiguration testsConfiguration;
private final DataHubConfiguration datahubConfiguration;
private final ViewsConfiguration viewsConfiguration;

private final DatasetType datasetType;
private final CorpUserType corpUserType;
Expand Down Expand Up @@ -361,6 +379,7 @@ public class GmsGraphQLEngine {
private final DataHubPolicyType dataHubPolicyType;
private final DataHubRoleType dataHubRoleType;
private final SchemaFieldType schemaFieldType;
private final DataHubViewType dataHubViewType;

/**
* Configures the graph objects that can be fetched primary key.
Expand Down Expand Up @@ -398,8 +417,12 @@ public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graph
final TimelineService timelineService, final boolean supportsImpactAnalysis,
final VisualConfiguration visualConfiguration, final TelemetryConfiguration telemetryConfiguration,
final TestsConfiguration testsConfiguration, final DataHubConfiguration datahubConfiguration,
final SiblingGraphService siblingGraphService, final GroupService groupService, final RoleService roleService,
final InviteTokenService inviteTokenService, final PostService postService, final FeatureFlags featureFlags) {
final ViewsConfiguration viewsConfiguration, final SiblingGraphService siblingGraphService,
final GroupService groupService, final RoleService roleService,
final InviteTokenService inviteTokenService, final PostService postService,
final ViewService viewService,
final SettingsService settingsService,
final FeatureFlags featureFlags) {

this.entityClient = entityClient;
this.graphClient = graphClient;
Expand All @@ -421,6 +444,8 @@ public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graph
this.roleService = roleService;
this.inviteTokenService = inviteTokenService;
this.postService = postService;
this.viewService = viewService;
this.settingsService = settingsService;

this.ingestionConfiguration = Objects.requireNonNull(ingestionConfiguration);
this.authenticationConfiguration = Objects.requireNonNull(authenticationConfiguration);
Expand All @@ -429,6 +454,7 @@ public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graph
this.telemetryConfiguration = telemetryConfiguration;
this.testsConfiguration = testsConfiguration;
this.datahubConfiguration = datahubConfiguration;
this.viewsConfiguration = viewsConfiguration;
this.featureFlags = featureFlags;

this.datasetType = new DatasetType(entityClient);
Expand Down Expand Up @@ -459,6 +485,8 @@ public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graph
this.dataHubPolicyType = new DataHubPolicyType(entityClient);
this.dataHubRoleType = new DataHubRoleType(entityClient);
this.schemaFieldType = new SchemaFieldType();
this.dataHubViewType = new DataHubViewType(entityClient);

// Init Lists
this.entityTypes = ImmutableList.of(
datasetType,
Expand Down Expand Up @@ -487,7 +515,8 @@ public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graph
testType,
dataHubPolicyType,
dataHubRoleType,
schemaFieldType
schemaFieldType,
dataHubViewType
);
this.loadableTypes = new ArrayList<>(entityTypes);
this.ownerTypes = ImmutableList.of(corpUserType, corpGroupType);
Expand Down Expand Up @@ -548,6 +577,7 @@ public void configureRuntimeWiring(final RuntimeWiring.Builder builder) {
configureRoleResolvers(builder);
configureSchemaFieldResolvers(builder);
configureEntityPathResolvers(builder);
configureViewResolvers(builder);
}

public GraphQLEngine.Builder builder() {
Expand Down Expand Up @@ -637,11 +667,12 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
this.visualConfiguration,
this.telemetryConfiguration,
this.testsConfiguration,
this.datahubConfiguration
this.datahubConfiguration,
this.viewsConfiguration
))
.dataFetcher("me", new MeResolver(this.entityClient, featureFlags))
.dataFetcher("search", new SearchResolver(this.entityClient))
.dataFetcher("searchAcrossEntities", new SearchAcrossEntitiesResolver(this.entityClient))
.dataFetcher("searchAcrossEntities", new SearchAcrossEntitiesResolver(this.entityClient, this.viewService))
.dataFetcher("searchAcrossLineage", new SearchAcrossLineageResolver(this.entityClient))
.dataFetcher("autoComplete", new AutoCompleteResolver(searchableTypes))
.dataFetcher("autoCompleteForMultiple", new AutoCompleteForMultipleResolver(searchableTypes))
Expand Down Expand Up @@ -697,6 +728,9 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("getInviteToken", new GetInviteTokenResolver(this.inviteTokenService))
.dataFetcher("listPosts", new ListPostsResolver(this.entityClient))
.dataFetcher("batchGetStepStates", new BatchGetStepStatesResolver(this.entityClient))
.dataFetcher("listMyViews", new ListMyViewsResolver(this.entityClient))
.dataFetcher("listGlobalViews", new ListGlobalViewsResolver(this.entityClient))
.dataFetcher("globalViewsSettings", new GlobalViewsSettingsResolver(this.settingsService))
);
}

Expand Down Expand Up @@ -821,6 +855,11 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("acceptRole", new AcceptRoleResolver(this.roleService, this.inviteTokenService))
.dataFetcher("createPost", new CreatePostResolver(this.postService))
.dataFetcher("batchUpdateStepStates", new BatchUpdateStepStatesResolver(this.entityClient))
.dataFetcher("createView", new CreateViewResolver(this.viewService))
.dataFetcher("updateView", new UpdateViewResolver(this.viewService))
.dataFetcher("deleteView", new DeleteViewResolver(this.viewService))
.dataFetcher("updateGlobalViewsSettings", new UpdateGlobalViewsSettingsResolver(this.settingsService))
.dataFetcher("updateCorpUserViewsSettings", new UpdateCorpUserViewsSettingsResolver(this.settingsService))
);
}

Expand Down Expand Up @@ -1489,6 +1528,31 @@ private void configureRoleResolvers(final RuntimeWiring.Builder builder) {
typeWiring -> typeWiring.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient)));
}

private void configureViewResolvers(final RuntimeWiring.Builder builder) {
builder
.type("DataHubView",
typeWiring -> typeWiring.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient)))
.type("ListViewsResult", typeWiring -> typeWiring
.dataFetcher("views", new LoadableTypeBatchResolver<>(
dataHubViewType,
(env) -> ((ListViewsResult) env.getSource()).getViews().stream()
.map(DataHubView::getUrn)
.collect(Collectors.toList())))
)
.type("CorpUserViewsSettings", typeWiring -> typeWiring
.dataFetcher("defaultView", new LoadableTypeResolver<>(
dataHubViewType,
(env) -> {
final CorpUserViewsSettings settings = env.getSource();
if (settings.getDefaultView() != null) {
return settings.getDefaultView().getUrn();
}
return null;
}
)
));
}

private void configureDataProcessInstanceResolvers(final RuntimeWiring.Builder builder) {
builder.type("DataProcessInstance",
typeWiring -> typeWiring.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public static boolean canCreateGlobalAnnouncements(@Nonnull QueryContext context
return isAuthorized(context, Optional.empty(), PoliciesConfig.CREATE_GLOBAL_ANNOUNCEMENTS_PRIVILEGE);
}

public static boolean canManageGlobalViews(@Nonnull QueryContext context) {
return isAuthorized(context, Optional.empty(), PoliciesConfig.MANAGE_GLOBAL_VIEWS);
}

public static boolean isAuthorized(
@Nonnull QueryContext context,
@Nonnull Optional<ResourceSpec> resourceSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ImmutableMap;
import com.linkedin.datahub.graphql.generated.EntityType;
import com.linkedin.metadata.Constants;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -35,6 +36,7 @@ public class EntityTypeMapper {
.put(EntityType.NOTEBOOK, "notebook")
.put(EntityType.DATA_PLATFORM_INSTANCE, "dataPlatformInstance")
.put(EntityType.TEST, "test")
.put(EntityType.DATAHUB_VIEW, Constants.DATAHUB_VIEW_ENTITY_NAME)
.build();

private static final Map<String, EntityType> ENTITY_NAME_TO_TYPE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public CompletableFuture<AuthenticatedUser> get(DataFetchingEnvironment environm
platformPrivileges.setCreateDomains(AuthorizationUtils.canCreateDomains(context));
platformPrivileges.setCreateTags(AuthorizationUtils.canCreateTags(context));
platformPrivileges.setManageTags(AuthorizationUtils.canManageTags(context));
platformPrivileges.setManageGlobalViews(AuthorizationUtils.canManageGlobalViews(context));

// Construct and return authenticated user object.
final AuthenticatedUser authUser = new AuthenticatedUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.linkedin.datahub.graphql.exception.ValidationException;
import com.linkedin.datahub.graphql.generated.FacetFilterInput;

import com.linkedin.datahub.graphql.generated.OrFilter;
import com.linkedin.datahub.graphql.generated.AndFilterInput;
import com.linkedin.metadata.query.filter.Condition;
import com.linkedin.metadata.query.filter.Criterion;
import com.linkedin.metadata.query.filter.CriterionArray;
Expand Down Expand Up @@ -103,7 +103,7 @@ public static List<Criterion> criterionListFromAndFilter(List<FacetFilterInput>
// In the case that user sends filters to be or-d together, we need to build a series of conjunctive criterion
// arrays, rather than just one for the AND case.
public static ConjunctiveCriterionArray buildConjunctiveCriterionArrayWithOr(
@Nonnull List<OrFilter> orFilters
@Nonnull List<AndFilterInput> orFilters
) {
return new ConjunctiveCriterionArray(orFilters.stream().map(orFilter -> {
CriterionArray andCriterionForOr = new CriterionArray(criterionListFromAndFilter(orFilter.getAnd()));
Expand All @@ -115,7 +115,7 @@ public static ConjunctiveCriterionArray buildConjunctiveCriterionArrayWithOr(
}

@Nullable
public static Filter buildFilter(@Nullable List<FacetFilterInput> andFilters, @Nullable List<OrFilter> orFilters) {
public static Filter buildFilter(@Nullable List<FacetFilterInput> andFilters, @Nullable List<AndFilterInput> orFilters) {
if ((andFilters == null || andFilters.isEmpty()) && (orFilters == null || orFilters.isEmpty())) {
return null;
}
Expand Down
Loading

0 comments on commit 921fe77

Please sign in to comment.