Skip to content
Draft
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,66 @@
{

Check failure on line 1 in specification/materializedviews/MaterializedViews.Management/examples/2025-04-01/MaterializedViews_CreateOrUpdate.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/materializedviews/MaterializedViews.Management/examples/2025-04-01/MaterializedViews_CreateOrUpdate.json#L1

specification/materializedviews/MaterializedViews.Management/examples/2025-04-01/MaterializedViews_CreateOrUpdate.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/materializedviews/MaterializedViews.Management/examples/2025-04-01/MaterializedViews_CreateOrUpdate.json
"operationId": "MaterializedViews_CreateOrUpdate",
"title": "Create or update a MaterializedView",
"parameters": {
"subscriptionId": "12345678-1234-1234-1234-123456789012",
"resourceGroupName": "testrg",
"materializedViewName": "testview",
"api-version": "2025-04-01",
"resource": {
"location": "East US",
"properties": {
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/testrg/providers/Microsoft.MaterializedViews/materializedViews/testview",
"name": "testview",
"type": "Microsoft.MaterializedViews/materializedViews",
"location": "East US",
"properties": {
"provisioningState": "Succeeded",
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
},
"201": {
"body": {
"id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/testrg/providers/Microsoft.MaterializedViews/materializedViews/testview",
"name": "testview",
"type": "Microsoft.MaterializedViews/materializedViews",
"location": "East US",
"properties": {
"provisioningState": "Provisioning",
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
}
}
}
130 changes: 130 additions & 0 deletions specification/materializedviews/MaterializedViews.Management/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;
using Azure.Core;

@armProviderNamespace
@service(#{ title: "Microsoft MaterializedViews Management Service" })
@doc("Microsoft MaterializedViews Management Service")
@versioned(Microsoft.MaterializedViews.Versions)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
namespace Microsoft.MaterializedViews;

/** The available API versions. */
enum Versions {
/** 2025-04-01 version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
v2025_04_01: "2025-04-01",
}

interface Operations extends Azure.ResourceManager.Operations {}

@doc("A MaterializedView resource")
model MaterializedViewResource is TrackedResource<MaterializedViewProperties> {
@pattern("^[a-zA-Z][a-zA-Z0-9-]{2,63}$")
@key("materializedViewName")
@segment("materializedViews")
@doc("MaterializedView resource name")
@visibility(Lifecycle.Read)
@path
name: string;
}

@doc("The properties of MaterializedView resource")
model MaterializedViewProperties {
@doc("Provisioning state of MaterializedView resource.")
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;

@doc("The definition of the materialized view")
viewDefinition?: string;

@doc("The refresh policy of the materialized view")
refreshPolicy?: RefreshPolicy;

@doc("The data source connection information")
dataSource?: DataSourceInfo;
}

@doc("Provisioning state of the resource")
@lroStatus
union ProvisioningState {
@doc("Resource has been created.")
Succeeded: "Succeeded",

@doc("Resource creation failed.")
Failed: "Failed",

@doc("Resource creation was canceled.")
Canceled: "Canceled",

@doc("This state indicates that the resource is being provisioned.")
Provisioning: "Provisioning",

@doc("This state indicates that the resource is being updated.")
Updating: "Updating",

@doc("This state indicates that the resource is being deleted.")
Deleting: "Deleting",

@doc("This state indicates that the operation on the resource has been accepted.")
Accepted: "Accepted",

string,
}

@doc("Refresh policy for the materialized view")
model RefreshPolicy {
@doc("Whether the materialized view is automatically refreshed")
isAutoRefresh?: boolean;

@doc("Refresh interval in minutes")
refreshIntervalMinutes?: int32;
}

@doc("Data source information for the materialized view")
model DataSourceInfo {
@doc("The connection string to the data source")
connectionString?: string;

@doc("The type of data source")
dataSourceType?: DataSourceType;
}

@doc("Type of data source")
union DataSourceType {
@doc("SQL Server data source")
SqlServer: "SqlServer",

@doc("PostgreSQL data source")
PostgreSQL: "PostgreSQL",

@doc("Azure SQL Database")
AzureSqlDatabase: "AzureSqlDatabase",

string,
}

@armResourceOperations
interface MaterializedViews {
get is ArmResourceRead<MaterializedViewResource>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<MaterializedViewResource>;
update is ArmTagsPatchAsync<MaterializedViewResource>;
delete is ArmResourceDeleteWithoutOkAsync<MaterializedViewResource>;
listByResourceGroup is ArmResourceListByParent<MaterializedViewResource>;
listBySubscription is ArmListBySubscription<MaterializedViewResource>;

@doc("Refresh a materialized view")
@action("refresh")
refresh is ArmResourceActionNoResponseContentAsync<
MaterializedViewResource,
void
>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
parameters:
"service-dir":
default: "sdk/materializedviews"
emit:
- "@azure-tools/typespec-autorest"
options:
"@azure-tools/typespec-autorest":
omit-unreachable-types: true
emitter-output-dir: "{project-root}/.."
azure-resource-provider-folder: "resource-manager"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/materializedviews.json"
examples-dir: "{project-root}/examples"
"@azure-tools/typespec-csharp":
flavor: azure
package-dir: "Azure.ResourceManager.MaterializedViews"
clear-output-folder: true
model-namespace: false
namespace: "{package-dir}"
"@azure-tools/typespec-python":
package-dir: "azure-mgmt-materializedviews"
namespace: "azure.mgmt.materializedviews"
generate-test: true
generate-sample: true
flavor: "azure"
"@azure-tools/typespec-java":
package-dir: "azure-resourcemanager-materializedviews"
namespace: "com.azure.resourcemanager.materializedviews"
service-name: "MaterializedViews"
flavor: azure
"@azure-tools/typespec-ts":
service-dir: sdk/materializedviews
package-dir: "arm-materializedviews"
is-modular-library: true
flavor: "azure"
experimental-extensible-enums: true
package-details:
name: "@azure/arm-materializedviews"
"@azure-tools/typespec-go":
service-dir: "sdk/resourcemanager/materializedviews"
package-dir: "armmaterializedviews"
module: "github.com/Azure/azure-sdk-for-go/{service-dir}/{package-dir}"
fix-const-stuttering: true
flavor: "azure"
generate-samples: true
generate-fakes: true
head-as-boolean: true
inject-spans: true
linter:
extends:
- "@azure-tools/typespec-azure-rulesets/resource-manager"
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{

Check failure on line 1 in specification/materializedviews/resource-manager/Microsoft.MaterializedViews/stable/2025-04-01/examples/MaterializedViews_CreateOrUpdate.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/materializedviews/resource-manager/Microsoft.MaterializedViews/stable/2025-04-01/examples/MaterializedViews_CreateOrUpdate.json#L1

specification/materializedviews/resource-manager/Microsoft.MaterializedViews/stable/2025-04-01/examples/MaterializedViews_CreateOrUpdate.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/materializedviews/resource-manager/Microsoft.MaterializedViews/stable/2025-04-01/examples/MaterializedViews_CreateOrUpdate.json
"operationId": "MaterializedViews_CreateOrUpdate",
"title": "Create or update a MaterializedView",
"parameters": {
"subscriptionId": "12345678-1234-1234-1234-123456789012",
"resourceGroupName": "testrg",
"materializedViewName": "testview",
"api-version": "2025-04-01",
"resource": {
"location": "East US",
"properties": {
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/testrg/providers/Microsoft.MaterializedViews/materializedViews/testview",
"name": "testview",
"type": "Microsoft.MaterializedViews/materializedViews",
"location": "East US",
"properties": {
"provisioningState": "Succeeded",
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
},
"201": {
"body": {
"id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/testrg/providers/Microsoft.MaterializedViews/materializedViews/testview",
"name": "testview",
"type": "Microsoft.MaterializedViews/materializedViews",
"location": "East US",
"properties": {
"provisioningState": "Provisioning",
"viewDefinition": "SELECT * FROM source_table WHERE active = 1",
"refreshPolicy": {
"isAutoRefresh": true,
"refreshIntervalMinutes": 60
},
"dataSource": {
"connectionString": "Server=myserver;Database=mydatabase;",
"dataSourceType": "SqlServer"
}
}
}
}
}
}
Loading
Loading