mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:11:57 +00:00
With #62911, per-enterprise-subscription model allowlists are no longer respected, so we can safely update the UI to remove mentions of allowlists, and also update our various allowlist-evaluation mechanisms in `licensing` and GraphQL resolvers to just provide a wildcard allowlist instead. It's not strictly required, but will make how the model allowlists work more clearer/explicit. Because we have a [planned migration for all this state to Enterprise Portal](https://linear.app/sourcegraph/project/kr-enterprise-portal-manages-all-enterprise-subscriptions-12f1d5047bd2/overview), we're not making any database changes. Part of https://linear.app/sourcegraph/issue/CORE-135 ### Context In https://sourcegraph.slack.com/archives/C05SZB829D0/p1715638980052279 we shared a decision we landed on as part of #62263: > Ignoring (then removing) per-subscription model allowlists: As part of the API discussions, we've also surfaced some opportunities for improvements - to make it easier to roll out new models to Enterprise, we're not including per-subscription model allowlists in the new API, and as part of the Cody Gateway migration (by end-of-June), we will update Cody Gateway to stop enforcing per-subscription model allowlists. Cody Gateway will still retain a Cody-Gateway-wide model allowlist. [@chrsmith](https://sourcegraph.slack.com/team/U061QHKUBJ8) is working on a broader design here and will have more to share on this later. This means there is one less thing for us to migrate as part of https://github.com/sourcegraph/sourcegraph/pull/62934, and avoids the need to add an API field that will be removed shortly post-migration. As part of this, rolling out new models to Enterprise customers no longer require additional code/override changes. ## Test plan Various tests pass. Visual inspection of `sg start dotcom`: - **Before:** <img width="947" alt="image" src="https://github.com/sourcegraph/sourcegraph/assets/23356519/2dc0ab72-c77d-4c0e-a57e-4c336041da4e"> - **After:**
543 lines
14 KiB
GraphQL
543 lines
14 KiB
GraphQL
"""
|
|
Mutations that are only used on Sourcegraph.com.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type DotcomMutation {
|
|
"""
|
|
Creates new product subscription for an account.
|
|
Only Sourcegraph.com site admins may perform this mutation.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
createProductSubscription(
|
|
"""
|
|
The ID of the user (i.e., customer) to whom this product subscription is assigned.
|
|
"""
|
|
accountID: ID!
|
|
): ProductSubscription!
|
|
"""
|
|
Generates and signs a new product license and associates it with an existing product subscription. The
|
|
product license key is signed with Sourcegraph.com's private key and is verifiable with the corresponding
|
|
public key.
|
|
Only Sourcegraph.com site admins may perform this mutation.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
generateProductLicenseForSubscription(
|
|
"""
|
|
The product subscription to associate with the license.
|
|
"""
|
|
productSubscriptionID: ID!
|
|
"""
|
|
The license to generate.
|
|
"""
|
|
license: ProductLicenseInput!
|
|
): ProductLicense!
|
|
"""
|
|
Revokes an existing product license, rendering it invalid.
|
|
"""
|
|
revokeLicense(
|
|
"""
|
|
The UUID of the license to revoke
|
|
"""
|
|
id: ID!
|
|
"""
|
|
Reason for revoking of the license
|
|
"""
|
|
reason: String!
|
|
): EmptyResponse!
|
|
"""
|
|
Applies a partial update to a product subscription.
|
|
|
|
Only Sourcegraph.com site admins may perform this mutation.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
updateProductSubscription(
|
|
"""
|
|
The product subscription ID to update.
|
|
"""
|
|
id: ID!
|
|
"""
|
|
Partial update to apply.
|
|
"""
|
|
update: UpdateProductSubscriptionInput!
|
|
): EmptyResponse!
|
|
"""
|
|
Archives an existing product subscription.
|
|
Only Sourcegraph.com site admins may perform this mutation.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
archiveProductSubscription(
|
|
"""
|
|
The product subscription to archive.
|
|
"""
|
|
id: ID!
|
|
): EmptyResponse!
|
|
}
|
|
|
|
"""
|
|
Mutations that are only used on Sourcegraph.com.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type DotcomQuery {
|
|
"""
|
|
The product subscription with the given UUID. An error is returned if no such product
|
|
subscription exists.
|
|
Only Sourcegraph.com site admins and the account owners of the product subscription may
|
|
perform this query.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
productSubscription(uuid: String!): ProductSubscription!
|
|
"""
|
|
The access available to the product subscription with the given access token.
|
|
The returned ProductSubscription may be archived or not associated with an active license.
|
|
|
|
Only Sourcegraph.com site admins, the account owners of the product subscription, and
|
|
specific service accounts may perform this query.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
productSubscriptionByAccessToken(accessToken: String!): ProductSubscription!
|
|
"""
|
|
A list of product subscriptions.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
productSubscriptions(
|
|
"""
|
|
Returns the first n product subscriptions from the list.
|
|
"""
|
|
first: Int
|
|
"""
|
|
Returns only product subscriptions for the given account.
|
|
Only Sourcegraph.com site admins may perform this query with account == null.
|
|
"""
|
|
account: ID
|
|
"""
|
|
Returns product subscriptions from users with usernames or email addresses that match the query.
|
|
"""
|
|
query: String
|
|
): ProductSubscriptionConnection!
|
|
|
|
"""
|
|
A list of product licenses.
|
|
Only Sourcegraph.com site admins may perform this query.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
productLicenses(
|
|
"""
|
|
Returns the first n product subscriptions from the list.
|
|
"""
|
|
first: Int
|
|
"""
|
|
Returns only product subscriptions whose license key contains this substring.
|
|
"""
|
|
licenseKeySubstring: String
|
|
"""
|
|
Returns only product licenses associated with the given subscription
|
|
"""
|
|
productSubscriptionID: ID
|
|
): ProductLicenseConnection!
|
|
|
|
"""
|
|
A dotcom user for purposes of connecting to the Cody Gateway.
|
|
Only Sourcegraph.com site admins or service accounts may perform this query.
|
|
Token is a Cody Gateway token, not a Sourcegraph instance access token.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
codyGatewayDotcomUserByToken(token: String!): CodyGatewayDotcomUser
|
|
|
|
"""
|
|
The current rate limit status for a dotcom user stored in Cody Gateway.
|
|
"""
|
|
codyGatewayRateLimitStatusByUserName(
|
|
"""
|
|
The username of the user to get the rate limit status for.
|
|
"""
|
|
username: String!
|
|
): [CodyGatewayRateLimitStatus!]
|
|
}
|
|
|
|
extend type Mutation {
|
|
"""
|
|
Mutations that are only used on Sourcegraph.com.
|
|
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
dotcom: DotcomMutation!
|
|
}
|
|
|
|
extend type Query {
|
|
"""
|
|
Queries that are only used on Sourcegraph.com.
|
|
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
dotcom: DotcomQuery!
|
|
}
|
|
|
|
"""
|
|
A list of product subscriptions.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type ProductSubscriptionConnection {
|
|
"""
|
|
A list of product subscriptions.
|
|
"""
|
|
nodes: [ProductSubscription!]!
|
|
"""
|
|
The total count of product subscriptions in the connection. This total count may be larger than the number of
|
|
nodes in this object when the result is paginated.
|
|
"""
|
|
totalCount: Int!
|
|
"""
|
|
Pagination information.
|
|
"""
|
|
pageInfo: PageInfo!
|
|
}
|
|
|
|
"""
|
|
An input type that describes a product license to be generated and signed.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
input ProductLicenseInput {
|
|
"""
|
|
The tags that indicate which features are activated by this license.
|
|
"""
|
|
tags: [String!]!
|
|
"""
|
|
The number of users for which this product subscription is valid.
|
|
"""
|
|
userCount: Int!
|
|
"""
|
|
The expiration date of this product license, expressed as the number of seconds since the epoch.
|
|
"""
|
|
expiresAt: Int!
|
|
"""
|
|
The Salesforce subscription ID associated with this product license.
|
|
"""
|
|
salesforceSubscriptionID: String
|
|
"""
|
|
The Salesforce opportunity ID associated with this product license.
|
|
"""
|
|
salesforceOpportunityID: String
|
|
}
|
|
|
|
"""
|
|
A product license that was created on Sourcegraph.com.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type ProductLicense implements Node {
|
|
"""
|
|
The unique ID of this product license.
|
|
"""
|
|
id: ID!
|
|
"""
|
|
The product subscription associated with this product license.
|
|
"""
|
|
subscription: ProductSubscription!
|
|
"""
|
|
Information about this product license.
|
|
"""
|
|
info: ProductLicenseInfo
|
|
"""
|
|
The license key.
|
|
"""
|
|
licenseKey: String!
|
|
"""
|
|
Site ID of the instance that uses the license.
|
|
"""
|
|
siteID: String
|
|
"""
|
|
The date when this product license was created.
|
|
"""
|
|
createdAt: DateTime!
|
|
"""
|
|
The date when this product license was revoked.
|
|
"""
|
|
revokedAt: DateTime
|
|
"""
|
|
The reason for revoking product license.
|
|
"""
|
|
revokeReason: String
|
|
"""
|
|
The version of the license.
|
|
"""
|
|
version: Int!
|
|
}
|
|
|
|
"""
|
|
A list of product licenses.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type ProductLicenseConnection {
|
|
"""
|
|
A list of product licenses.
|
|
"""
|
|
nodes: [ProductLicense!]!
|
|
"""
|
|
The total count of product licenses in the connection. This total count may be larger than the number of
|
|
nodes in this object when the result is paginated.
|
|
"""
|
|
totalCount: Int!
|
|
"""
|
|
Pagination information.
|
|
"""
|
|
pageInfo: PageInfo!
|
|
}
|
|
|
|
"""
|
|
A product subscription that was created on Sourcegraph.com.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type ProductSubscription implements Node {
|
|
"""
|
|
The unique ID of this product subscription.
|
|
"""
|
|
id: ID!
|
|
"""
|
|
The unique UUID of this product subscription. Unlike ProductSubscription.id, this does not
|
|
encode the type and is not a GraphQL node ID.
|
|
"""
|
|
uuid: String!
|
|
"""
|
|
A name for the product subscription derived from its ID. The name is not guaranteed to be unique.
|
|
"""
|
|
name: String!
|
|
"""
|
|
The user (i.e., customer) to whom this subscription is granted, or null if the account has been deleted.
|
|
"""
|
|
account: User
|
|
"""
|
|
The currently active product license associated with this product subscription, if any.
|
|
"""
|
|
activeLicense: ProductLicense
|
|
"""
|
|
A list of product licenses associated with this product subscription.
|
|
Only Sourcegraph.com site admins may list inactive product licenses (other viewers should use
|
|
ProductSubscription.activeLicense).
|
|
"""
|
|
productLicenses(
|
|
"""
|
|
Returns the first n product licenses from the list.
|
|
"""
|
|
first: Int
|
|
): ProductLicenseConnection!
|
|
"""
|
|
The most preferable Sourcegraph access token to use for authenticating as the
|
|
subscription holder with managed Sourcegraph services.
|
|
Null only if creating a token failed, for example when no active license exists.
|
|
"""
|
|
currentSourcegraphAccessToken: String
|
|
"""
|
|
Available access tokens for authenticating as the subscription holder with managed
|
|
Sourcegraph services.
|
|
"""
|
|
sourcegraphAccessTokens: [String!]!
|
|
"""
|
|
Cody Gateway access granted to this subscription. Properties may be inferred from the active license, or be defined in overrides.
|
|
"""
|
|
codyGatewayAccess: CodyGatewayAccess!
|
|
"""
|
|
The date when this product subscription was created.
|
|
"""
|
|
createdAt: DateTime!
|
|
"""
|
|
Whether this product subscription was archived.
|
|
"""
|
|
isArchived: Boolean!
|
|
"""
|
|
The URL to view this product subscription.
|
|
"""
|
|
url: String!
|
|
"""
|
|
The URL to view this product subscription in the site admin area.
|
|
Only Sourcegraph.com site admins may query this field.
|
|
"""
|
|
urlForSiteAdmin: String
|
|
}
|
|
|
|
"""
|
|
A usage data point of Cody Gateway usage of a subscription.
|
|
"""
|
|
type CodyGatewayUsageDatapoint {
|
|
"""
|
|
The day the usage occurred.
|
|
"""
|
|
date: DateTime!
|
|
"""
|
|
The number of requests made.
|
|
"""
|
|
count: BigInt!
|
|
"""
|
|
The model that was used.
|
|
"""
|
|
model: String!
|
|
}
|
|
|
|
"""
|
|
Cody Gateway access granted to a subscription.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type CodyGatewayAccess {
|
|
"""
|
|
Whether or not a subscription has Cody Gateway access.
|
|
"""
|
|
enabled: Boolean!
|
|
"""
|
|
Rate limit for chat completions access, or null if not enabled.
|
|
"""
|
|
chatCompletionsRateLimit: CodyGatewayRateLimit
|
|
"""
|
|
Rate limit for code completions access, or null if not enabled.
|
|
"""
|
|
codeCompletionsRateLimit: CodyGatewayRateLimit
|
|
"""
|
|
Rate limit for embedding text chunks, or null if not enabled.
|
|
"""
|
|
embeddingsRateLimit: CodyGatewayRateLimit
|
|
}
|
|
|
|
"""
|
|
The source of the rate limit returned.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
enum CodyGatewayRateLimitSource {
|
|
"""
|
|
Indicates that a custom override for the rate limit has been stored.
|
|
"""
|
|
OVERRIDE
|
|
|
|
"""
|
|
Indicates that the rate limit is inferred by the subscriptions active plan.
|
|
"""
|
|
PLAN
|
|
}
|
|
|
|
"""
|
|
Cody Gateway access rate limits for a subscription.
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type CodyGatewayRateLimit {
|
|
"""
|
|
The source of the rate limit configuration.
|
|
"""
|
|
source: CodyGatewayRateLimitSource!
|
|
"""
|
|
The models that are allowed for this rate limit bucket.
|
|
Usually, customers will have two separate rate limits, one
|
|
for chat completions and one for code completions. A usual
|
|
config could include:
|
|
|
|
chatCompletionsRateLimit: {
|
|
allowedModels: [anthropic/claude-v1, anthropic/claude-v1.3]
|
|
},
|
|
codeCompletionsRateLimit: {
|
|
allowedModels: [anthropic/claude-instant-v1]
|
|
}
|
|
|
|
In general, the model names are of the format "$PROVIDER/$MODEL_NAME".
|
|
"""
|
|
allowedModels: [String!]!
|
|
"""
|
|
Requests per time interval.
|
|
"""
|
|
limit: BigInt!
|
|
"""
|
|
Interval for rate limiting.
|
|
"""
|
|
intervalSeconds: Int!
|
|
"""
|
|
Recent usage data of Cody Gateway for the subscription.
|
|
"""
|
|
usage: [CodyGatewayUsageDatapoint!]!
|
|
}
|
|
|
|
"""
|
|
Partial update to apply to a subscription. Omitted fields are not applied.
|
|
"""
|
|
input UpdateProductSubscriptionInput {
|
|
"""
|
|
Partial update to Cody Gateway access granted to this subscription.
|
|
"""
|
|
codyGatewayAccess: UpdateCodyGatewayAccessInput
|
|
}
|
|
|
|
"""
|
|
Partial update to apply to a subscription's Cody Gateway access. Omitted fields are not applied.
|
|
"""
|
|
input UpdateCodyGatewayAccessInput {
|
|
"""
|
|
Enable or disable Cody Gateway access.
|
|
"""
|
|
enabled: Boolean
|
|
"""
|
|
Override default requests per time interval.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
chatCompletionsRateLimit: BigInt
|
|
"""
|
|
Override default interval for rate limiting.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
chatCompletionsRateLimitIntervalSeconds: Int
|
|
"""
|
|
Override the set of allowed models for chat completions
|
|
for this subscription.
|
|
"""
|
|
chatCompletionsAllowedModels: [String!]
|
|
@deprecated(reason: "Enterprise no longer have per-subscription model allowlists.")
|
|
"""
|
|
Override default requests per time interval.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
codeCompletionsRateLimit: BigInt
|
|
"""
|
|
Override default interval for rate limiting.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
codeCompletionsRateLimitIntervalSeconds: Int
|
|
"""
|
|
Override the set of allowed models for chat completions
|
|
for this subscription.
|
|
"""
|
|
codeCompletionsAllowedModels: [String!]
|
|
@deprecated(reason: "Enterprise no longer have per-subscription model allowlists.")
|
|
"""
|
|
Override default requests per time interval for embeddings generation.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
embeddingsRateLimit: BigInt
|
|
"""
|
|
Override default interval for rate limiting for embeddings generation.
|
|
|
|
Set to 0 to remove the override.
|
|
"""
|
|
embeddingsRateLimitIntervalSeconds: Int
|
|
"""
|
|
Override the set of allowed models for embeddings generation for this subscription.
|
|
"""
|
|
embeddingsAllowedModels: [String!]
|
|
@deprecated(reason: "Enterprise no longer have per-subscription model allowlists.")
|
|
}
|
|
|
|
"""
|
|
A dotcom user allowed to access the Cody Gateway
|
|
FOR INTERNAL USE ONLY.
|
|
"""
|
|
type CodyGatewayDotcomUser {
|
|
"""
|
|
The id of the user
|
|
"""
|
|
id: ID!
|
|
"""
|
|
The user name of the user
|
|
"""
|
|
username: String!
|
|
"""
|
|
Cody Gateway access granted to this user. Properties may be inferred from dotcom site config, or be defined in overrides on the user.
|
|
"""
|
|
codyGatewayAccess: CodyGatewayAccess!
|
|
}
|