Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request update/241224 #504

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion diworker/diworker/importers/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def detect_period_start(self):
if last_exp_date:
self.period_start = last_exp_date.replace(
hour=0, minute=0, second=0, microsecond=0) - timedelta(
days=1)
days=3)
if not self.period_start:
super().detect_period_start()

Expand Down
2 changes: 2 additions & 0 deletions ngui/server/api/restapi/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class RestApiClient extends BaseClient {
...params.azureSubscriptionConfig,
...params.azureTenantConfig,
...params.gcpConfig,
...params.gcpTenantConfig,
...params.alibabaConfig,
...params.nebiusConfig,
...params.databricksConfig,
Expand Down Expand Up @@ -95,6 +96,7 @@ class RestApiClient extends BaseClient {
...params.azureSubscriptionConfig,
...params.azureTenantConfig,
...params.gcpConfig,
...params.gcpTenantConfig,
...params.alibabaConfig,
...params.nebiusConfig,
...params.databricksConfig,
Expand Down
115 changes: 97 additions & 18 deletions ngui/server/graphql/resolvers/restapi.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export type CreateDataSourceInput = {
azureTenantConfig?: InputMaybe<AzureTenantConfigInput>;
databricksConfig?: InputMaybe<DatabricksConfigInput>;
gcpConfig?: InputMaybe<GcpConfigInput>;
gcpTenantConfig?: InputMaybe<GcpTenantConfigInput>;
k8sConfig?: InputMaybe<K8sConfigInput>;
name?: InputMaybe<Scalars['String']['input']>;
nebiusConfig?: InputMaybe<NebiusConfigInput>;
Expand Down Expand Up @@ -190,18 +191,18 @@ export type DataSourceDiscoveryInfos = {
};

export type DataSourceInterface = {
account_id: Scalars['String']['output'];
account_id?: Maybe<Scalars['String']['output']>;
details?: Maybe<DataSourceDetails>;
id: Scalars['String']['output'];
last_getting_metric_attempt_at: Scalars['Int']['output'];
id?: Maybe<Scalars['String']['output']>;
last_getting_metric_attempt_at?: Maybe<Scalars['Int']['output']>;
last_getting_metric_attempt_error?: Maybe<Scalars['String']['output']>;
last_getting_metrics_at: Scalars['Int']['output'];
last_import_at: Scalars['Int']['output'];
last_import_attempt_at: Scalars['Int']['output'];
last_getting_metrics_at?: Maybe<Scalars['Int']['output']>;
last_import_at?: Maybe<Scalars['Int']['output']>;
last_import_attempt_at?: Maybe<Scalars['Int']['output']>;
last_import_attempt_error?: Maybe<Scalars['String']['output']>;
name: Scalars['String']['output'];
name?: Maybe<Scalars['String']['output']>;
parent_id?: Maybe<Scalars['String']['output']>;
type: DataSourceType;
type?: Maybe<DataSourceType>;
};

export type DataSourceRequestParams = {
Expand All @@ -216,6 +217,7 @@ export enum DataSourceType {
Databricks = 'databricks',
Environment = 'environment',
GcpCnr = 'gcp_cnr',
GcpTenant = 'gcp_tenant',
KubernetesCnr = 'kubernetes_cnr',
Nebius = 'nebius'
}
Expand Down Expand Up @@ -320,6 +322,40 @@ export type GcpDataSource = DataSourceInterface & {
type: DataSourceType;
};

export type GcpTenantBillingDataConfig = {
__typename?: 'GcpTenantBillingDataConfig';
dataset_name?: Maybe<Scalars['String']['output']>;
project_id?: Maybe<Scalars['String']['output']>;
table_name?: Maybe<Scalars['String']['output']>;
};

export type GcpTenantConfig = {
__typename?: 'GcpTenantConfig';
billing_data?: Maybe<GcpTenantBillingDataConfig>;
};

export type GcpTenantConfigInput = {
billing_data: GcpBillingDataConfigInput;
credentials: Scalars['JSONObject']['input'];
};

export type GcpTenantDataSource = DataSourceInterface & {
__typename?: 'GcpTenantDataSource';
account_id?: Maybe<Scalars['String']['output']>;
config?: Maybe<GcpTenantConfig>;
details?: Maybe<DataSourceDetails>;
id: Scalars['String']['output'];
last_getting_metric_attempt_at: Scalars['Int']['output'];
last_getting_metric_attempt_error?: Maybe<Scalars['String']['output']>;
last_getting_metrics_at: Scalars['Int']['output'];
last_import_at: Scalars['Int']['output'];
last_import_attempt_at: Scalars['Int']['output'];
last_import_attempt_error?: Maybe<Scalars['String']['output']>;
name: Scalars['String']['output'];
parent_id?: Maybe<Scalars['String']['output']>;
type: DataSourceType;
};

export type Invitation = {
__typename?: 'Invitation';
id: Scalars['String']['output'];
Expand All @@ -334,6 +370,7 @@ export type InvitationAssignment = {
id: Scalars['String']['output'];
purpose: Scalars['String']['output'];
scope_id: Scalars['String']['output'];
scope_name: Scalars['String']['output'];
scope_type: Scalars['String']['output'];
};

Expand Down Expand Up @@ -577,6 +614,7 @@ export type UpdateDataSourceInput = {
azureTenantConfig?: InputMaybe<AzureTenantConfigInput>;
databricksConfig?: InputMaybe<DatabricksConfigInput>;
gcpConfig?: InputMaybe<GcpConfigInput>;
gcpTenantConfig?: InputMaybe<GcpTenantConfigInput>;
k8sConfig?: InputMaybe<K8sConfigInput>;
lastImportAt?: InputMaybe<Scalars['Int']['input']>;
lastImportModifiedAt?: InputMaybe<Scalars['Int']['input']>;
Expand Down Expand Up @@ -674,7 +712,7 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs

/** Mapping of interface types */
export type ResolversInterfaceTypes<_RefType extends Record<string, unknown>> = {
DataSourceInterface: ( AlibabaDataSource ) | ( AwsDataSource ) | ( AzureSubscriptionDataSource ) | ( AzureTenantDataSource ) | ( DatabricksDataSource ) | ( EnvironmentDataSource ) | ( GcpDataSource ) | ( K8sDataSource ) | ( NebiusDataSource );
DataSourceInterface: ( AlibabaDataSource ) | ( AwsDataSource ) | ( AzureSubscriptionDataSource ) | ( AzureTenantDataSource ) | ( DatabricksDataSource ) | ( EnvironmentDataSource ) | ( GcpDataSource ) | ( GcpTenantDataSource ) | ( K8sDataSource ) | ( NebiusDataSource );
};

/** Mapping between all available schema types and the resolvers types */
Expand Down Expand Up @@ -711,6 +749,10 @@ export type ResolversTypes = {
GcpConfig: ResolverTypeWrapper<GcpConfig>;
GcpConfigInput: GcpConfigInput;
GcpDataSource: ResolverTypeWrapper<GcpDataSource>;
GcpTenantBillingDataConfig: ResolverTypeWrapper<GcpTenantBillingDataConfig>;
GcpTenantConfig: ResolverTypeWrapper<GcpTenantConfig>;
GcpTenantConfigInput: GcpTenantConfigInput;
GcpTenantDataSource: ResolverTypeWrapper<GcpTenantDataSource>;
ID: ResolverTypeWrapper<Scalars['ID']['output']>;
Int: ResolverTypeWrapper<Scalars['Int']['output']>;
Invitation: ResolverTypeWrapper<Invitation>;
Expand Down Expand Up @@ -769,6 +811,10 @@ export type ResolversParentTypes = {
GcpConfig: GcpConfig;
GcpConfigInput: GcpConfigInput;
GcpDataSource: GcpDataSource;
GcpTenantBillingDataConfig: GcpTenantBillingDataConfig;
GcpTenantConfig: GcpTenantConfig;
GcpTenantConfigInput: GcpTenantConfigInput;
GcpTenantDataSource: GcpTenantDataSource;
ID: Scalars['ID']['output'];
Int: Scalars['Int']['output'];
Invitation: Invitation;
Expand Down Expand Up @@ -917,19 +963,19 @@ export type DataSourceDiscoveryInfosResolvers<ContextType = any, ParentType exte
};

export type DataSourceInterfaceResolvers<ContextType = any, ParentType extends ResolversParentTypes['DataSourceInterface'] = ResolversParentTypes['DataSourceInterface']> = {
__resolveType: TypeResolveFn<'AlibabaDataSource' | 'AwsDataSource' | 'AzureSubscriptionDataSource' | 'AzureTenantDataSource' | 'DatabricksDataSource' | 'EnvironmentDataSource' | 'GcpDataSource' | 'K8sDataSource' | 'NebiusDataSource', ParentType, ContextType>;
account_id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__resolveType: TypeResolveFn<'AlibabaDataSource' | 'AwsDataSource' | 'AzureSubscriptionDataSource' | 'AzureTenantDataSource' | 'DatabricksDataSource' | 'EnvironmentDataSource' | 'GcpDataSource' | 'GcpTenantDataSource' | 'K8sDataSource' | 'NebiusDataSource', ParentType, ContextType>;
account_id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
details?: Resolver<Maybe<ResolversTypes['DataSourceDetails']>, ParentType, ContextType>;
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
last_getting_metric_attempt_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
last_getting_metric_attempt_at?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
last_getting_metric_attempt_error?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
last_getting_metrics_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_import_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_import_attempt_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_getting_metrics_at?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
last_import_at?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
last_import_attempt_at?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
last_import_attempt_error?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
name?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
parent_id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
type?: Resolver<ResolversTypes['DataSourceType'], ParentType, ContextType>;
type?: Resolver<Maybe<ResolversTypes['DataSourceType']>, ParentType, ContextType>;
};

export type DatabricksConfigResolvers<ContextType = any, ParentType extends ResolversParentTypes['DatabricksConfig'] = ResolversParentTypes['DatabricksConfig']> = {
Expand Down Expand Up @@ -1016,6 +1062,35 @@ export type GcpDataSourceResolvers<ContextType = any, ParentType extends Resolve
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type GcpTenantBillingDataConfigResolvers<ContextType = any, ParentType extends ResolversParentTypes['GcpTenantBillingDataConfig'] = ResolversParentTypes['GcpTenantBillingDataConfig']> = {
dataset_name?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
project_id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
table_name?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type GcpTenantConfigResolvers<ContextType = any, ParentType extends ResolversParentTypes['GcpTenantConfig'] = ResolversParentTypes['GcpTenantConfig']> = {
billing_data?: Resolver<Maybe<ResolversTypes['GcpTenantBillingDataConfig']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type GcpTenantDataSourceResolvers<ContextType = any, ParentType extends ResolversParentTypes['GcpTenantDataSource'] = ResolversParentTypes['GcpTenantDataSource']> = {
account_id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
config?: Resolver<Maybe<ResolversTypes['GcpTenantConfig']>, ParentType, ContextType>;
details?: Resolver<Maybe<ResolversTypes['DataSourceDetails']>, ParentType, ContextType>;
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
last_getting_metric_attempt_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_getting_metric_attempt_error?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
last_getting_metrics_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_import_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_import_attempt_at?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
last_import_attempt_error?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
parent_id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
type?: Resolver<ResolversTypes['DataSourceType'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type InvitationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Invitation'] = ResolversParentTypes['Invitation']> = {
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
invite_assignments?: Resolver<Maybe<Array<ResolversTypes['InvitationAssignment']>>, ParentType, ContextType>;
Expand All @@ -1029,6 +1104,7 @@ export type InvitationAssignmentResolvers<ContextType = any, ParentType extends
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
purpose?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
scope_id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
scope_name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
scope_type?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
Expand Down Expand Up @@ -1156,6 +1232,9 @@ export type Resolvers<ContextType = any> = {
GcpBillingDataConfig?: GcpBillingDataConfigResolvers<ContextType>;
GcpConfig?: GcpConfigResolvers<ContextType>;
GcpDataSource?: GcpDataSourceResolvers<ContextType>;
GcpTenantBillingDataConfig?: GcpTenantBillingDataConfigResolvers<ContextType>;
GcpTenantConfig?: GcpTenantConfigResolvers<ContextType>;
GcpTenantDataSource?: GcpTenantDataSourceResolvers<ContextType>;
Invitation?: InvitationResolvers<ContextType>;
InvitationAssignment?: InvitationAssignmentResolvers<ContextType>;
JSONObject?: GraphQLScalarType;
Expand Down
3 changes: 3 additions & 0 deletions ngui/server/graphql/resolvers/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const resolvers: Resolvers = {
case "gcp_cnr": {
return "GcpDataSource";
}
case "gcp_tenant": {
return "GcpTenantDataSource";
}
case "alibaba_cnr": {
return "AlibabaDataSource";
}
Expand Down
52 changes: 44 additions & 8 deletions ngui/server/graphql/schemas/restapi.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum DataSourceType {
azure_tenant
azure_cnr
gcp_cnr
gcp_tenant
alibaba_cnr
nebius
databricks
Expand Down Expand Up @@ -35,16 +36,16 @@ type DataSourceDetails {
}

interface DataSourceInterface {
id: String!
name: String!
type: DataSourceType!
id: String
name: String
type: DataSourceType
parent_id: String
account_id: String!
last_import_at: Int!
last_import_attempt_at: Int!
account_id: String
last_import_at: Int
last_import_attempt_at: Int
last_import_attempt_error: String
last_getting_metrics_at: Int!
last_getting_metric_attempt_at: Int!
last_getting_metrics_at: Int
last_getting_metric_attempt_at: Int
last_getting_metric_attempt_error: String
details: DataSourceDetails
}
Expand Down Expand Up @@ -151,6 +152,33 @@ type GcpDataSource implements DataSourceInterface {
config: GcpConfig
}

# GCP tenant data source
type GcpTenantBillingDataConfig {
dataset_name: String
table_name: String
project_id: String
}

type GcpTenantConfig {
billing_data: GcpTenantBillingDataConfig
}

type GcpTenantDataSource implements DataSourceInterface {
id: String!
name: String!
type: DataSourceType!
parent_id: String
account_id: String
last_import_at: Int!
last_import_attempt_at: Int!
last_import_attempt_error: String
last_getting_metrics_at: Int!
last_getting_metric_attempt_at: Int!
last_getting_metric_attempt_error: String
details: DataSourceDetails
config: GcpTenantConfig
}

# Alibaba data source
type AlibabaConfig {
access_key_id: String
Expand Down Expand Up @@ -309,6 +337,11 @@ input GcpConfigInput {
credentials: JSONObject!
}

input GcpTenantConfigInput {
billing_data: GcpBillingDataConfigInput!
credentials: JSONObject!
}

input AlibabaConfigInput {
access_key_id: String!
secret_access_key: String!
Expand Down Expand Up @@ -344,6 +377,7 @@ input CreateDataSourceInput {
azureSubscriptionConfig: AzureSubscriptionConfigInput
azureTenantConfig: AzureTenantConfigInput
gcpConfig: GcpConfigInput
gcpTenantConfig: GcpTenantConfigInput
alibabaConfig: AlibabaConfigInput
nebiusConfig: NebiusConfigInput
databricksConfig: DatabricksConfigInput
Expand All @@ -359,6 +393,7 @@ input UpdateDataSourceInput {
azureSubscriptionConfig: AzureSubscriptionConfigInput
azureTenantConfig: AzureTenantConfigInput
gcpConfig: GcpConfigInput
gcpTenantConfig: GcpTenantConfigInput
alibabaConfig: AlibabaConfigInput
nebiusConfig: NebiusConfigInput
databricksConfig: DatabricksConfigInput
Expand Down Expand Up @@ -405,6 +440,7 @@ type Employee {
type InvitationAssignment {
id: String!
scope_id: String!
scope_name: String!
scope_type: String!
purpose: String!
}
Expand Down
Loading
Loading