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

Onboard Liftr Neon Postgres service #30806

Merged
merged 3 commits into from
Oct 4, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "../LiftrBase/main.tsp";

import "@typespec/versioning";
import "@azure-tools/typespec-azure-resource-manager";

using Azure.ResourceManager;
using TypeSpec.Versioning;
using LiftrBase;

@versioned(LiftrBase.Data.Versions)
namespace LiftrBase.Data;

@doc("Supported versions for LiftrBase.Data resource model")
enum Versions {
@doc("Dependent on Azure.ResourceManager.Versions.v1_0_Preview_1 and LiftrBase.Versions.v1_preview")
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(LiftrBase.Versions.v1_preview)
v1_preview: "2024-08-01-preview",
}

@doc("Properties specific to Data Organization resource")
model OrganizationProperties is BaseResourceProperties {
@doc("Organization properties")
partnerOrganizationProperties?: PartnerOrganizationProperties;
}

@doc("Properties specific to Partner's organization")
model PartnerOrganizationProperties {
@doc("Organization Id in partner's system")
organizationId?: string;

@doc("Organization name in partner's system")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9_\\-.: ]*$")
@minLength(1)
@maxLength(50)
organizationName: string;

@doc("Single Sign On properties for the organization")
singleSignOnProperties?: SingleSignOnProperties;
}
157 changes: 157 additions & 0 deletions specification/liftrneon/Neon.Postgres.Management/LiftrBase/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/versioning";

using Azure.ResourceManager;
using TypeSpec.Versioning;

@versioned(LiftrBase.Versions)
namespace LiftrBase;

@doc("Supported versions for LiftrBase resource model")
enum Versions {
@doc("Dependent on Azure.ResourceManager.Versions.v1_0_Preview_1")
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
v1_preview: "2024-08-01-preview",
}

@doc("Marketplace subscription status of a resource.")
union MarketplaceSubscriptionStatus {
string,

@doc("Purchased but not yet activated")
PendingFulfillmentStart: "PendingFulfillmentStart",

@doc("Marketplace subscription is activated")
Subscribed: "Subscribed",

@doc("This state indicates that a customer's payment for the Marketplace service was not received")
Suspended: "Suspended",

@doc("Customer has cancelled the subscription")
Unsubscribed: "Unsubscribed",
}

@doc("A string that represents a URI.")
scalar Uri extends string;

@doc("Marketplace details for an organization")
model MarketplaceDetails {
@doc("SaaS subscription id for the the marketplace offer")
subscriptionId?: string;

@doc("Marketplace subscription status")
subscriptionStatus?: MarketplaceSubscriptionStatus;

@doc("Offer details for the marketplace that is selected by the user")
offerDetails: OfferDetails;
}

@doc("Offer details for the marketplace that is selected by the user")
model OfferDetails {
@doc("Publisher Id for the marketplace offer")
publisherId: string;

@doc("Offer Id for the marketplace offer")
offerId: string;

@doc("Plan Id for the marketplace offer")
planId: string;

@doc("Plan Name for the marketplace offer")
planName?: string;

@doc("Term Name for the marketplace offer")
termUnit?: string;

@doc("Term Id for the marketplace offer")
termId?: string;
}

@doc("Reusable representation of an email address.")
@pattern("^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$")
scalar email extends string;

@doc("User details for an organization")
model UserDetails {
@doc("First name of the user")
firstName?: string;

@doc("Last name of the user")
lastName?: string;

@doc("Email address of the user")
emailAddress?: email;

@doc("User's principal name")
upn?: string;

@doc("User's phone number")
phoneNumber?: string;
}

@doc("Company details for an organization")
model CompanyDetails {
@doc("Company name")
companyName?: string;

@doc("Country name of the company")
country?: string;

@doc("Office address of the company")
officeAddress?: string;

@doc("Business phone number of the company")
businessPhone?: string;

@doc("Domain of the user")
domain?: string;

@doc("Number of employees in the company")
numberOfEmployees?: int64;
}

@doc("Base resource properties that can be extended for arm resources.")
model BaseResourceProperties {
@doc("Marketplace details of the resource.")
@visibility("create", "read")
marketplaceDetails: MarketplaceDetails;

@doc("Details of the user.")
userDetails: UserDetails;

@doc("Details of the company.")
companyDetails: CompanyDetails;

@doc("Provisioning state of the resource.")
@visibility("read")
provisioningState?: ResourceProvisioningState;
}

@doc("Properties specific to Single Sign On Resource")
model SingleSignOnProperties {
@doc("State of the Single Sign On for the organization")
singleSignOnState?: SingleSignOnStates;

@doc("AAD enterprise application Id used to setup SSO")
enterpriseAppId?: string;

@doc("URL for SSO to be used by the partner to redirect the user to their system")
singleSignOnUrl?: Uri;

@doc("List of AAD domains fetched from Microsoft Graph for user.")
aadDomains?: string[];
}

@doc("Various states of the SSO resource")
union SingleSignOnStates {
string,

@doc("Initial state of the SSO resource")
Initial: "Initial",

@doc("SSO is enabled for the organization")
Enable: "Enable",

@doc("SSO is disabled for the organization")
Disable: "Disable",
}
28 changes: 28 additions & 0 deletions specification/liftrneon/Neon.Postgres.Management/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Neon Postgres service typespec project

## Getting started

- environment setup: https://microsoft.github.io/typespec/introduction/installation

## Generate Neon swagger

## NPM registry authentication

We have to use the Liftr Feed Service for NPM to fetch the typespec dependencies.
The `.npmrc` file configures the folder accordingly.

in development, you can tell npm to use the standard public registry by specifying it:

`npm install --registry https://registry.npmjs.org`

then:

`tsp compile .`

## Development

Always edit `tsp` files, and generate swagger, never edit the swagger directly.

For generating examples use the following command:

`oav generate-examples neon.json`
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Operations_List",
"operationId": "Operations_List",
"parameters": {
"api-version": "2024-08-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "ekvuojrpbuyogrikfuzyghio",
"isDataAction": true,
"display": {
"provider": "lvppuskqcdcoejwuvsqrloczvnouy",
"resource": "rvvd",
"operation": "odjjqnodcgszczpsdrhrpwmqssrybr",
"description": "bwmstukaiaoisiu"
},
"origin": "user",
"actionType": "Internal"
}
],
"nextLink": "https://contoso.com/nextlink"
}
}
}
}
Loading