contractsapi

package module
v0.0.0-...-2cb3ca2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: GPL-3.0 Imports: 0 Imported by: 1

Documentation

Overview

Package contractsapi exports some constants defining the Contracts Server backend REST API

Index

Constants

View Source
const (
	// Version is the current Contracts Server REST API version.
	Version = "/v1"

	// TokenPath is the path where clients should GET the Azure AD ephemeral token.
	TokenPath = "/token"
	// SubscriptionPath is the path where clients should POST the user JWT to notify the CS backend of changes in the current user subscription.
	SubscriptionPath = "/subscription"

	// TokenMaxSize is a safe token response size - tests with the real MS APIs suggested that those tokens will stay in between 1.2kB to 1.7kB.
	// Our Pro Token is much, much smaller.
	TokenMaxSize = 4096

	// ADTokenKey is the JSON key of the response payload of the /token endpoint.
	//#nosec G101 // False positive: this is not a credential
	ADTokenKey = "azure_ad_token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SubscriptionRequest

type SubscriptionRequest struct {
	// MSStoreIDKey is the user token generated on Ubuntu Pro Windows client using
	// Windows SDK.
	MSStoreIDKey string `json:"ms_store_id_key"`
}

SubscriptionRequest is the expected request body in json format for "/v1/subscription" endpoint.

Must keep in sync with https://github.com/canonical/cloud-contracts/blob/develop/wslsaas/internal/apiv1/apiv1.go#L58

type SyncUserSubscriptionsResponse

type SyncUserSubscriptionsResponse struct {
	SubscriptionEntitlements map[string]SyncUserSubscriptionsResponseItem `json:"subscriptionEntitlements"`
}

SyncUserSubscriptionsResponse is the structure for json response for /v1/subscription.

Must keep in sync with https://github.com/canonical/cloud-contracts/blob/develop/wslsaas/internal/apiv1/apiv1.go#L69

type SyncUserSubscriptionsResponseItem

type SyncUserSubscriptionsResponseItem struct {
	Token string `json:"contractToken"`
}

SyncUserSubscriptionsResponseItem is an indvidual subscription for the response to /v1/subscription.

Must keep in sync with: https://github.com/canonical/cloud-contracts/blob/develop/wslsaas/internal/apiv1/apiv1.go#L64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL