Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
35aa8a4
migrate
XiaofeiCao Jun 25, 2025
529471c
fix path
XiaofeiCao Jun 30, 2025
cabe42e
tspconfig.yaml
XiaofeiCao Jun 30, 2025
8b03d3f
fix flatten
XiaofeiCao Jun 30, 2025
85a364f
fix legacy template
XiaofeiCao Jun 30, 2025
94a5e82
fix examples
XiaofeiCao Jul 2, 2025
3819c3f
tsp compile
XiaofeiCao Jul 2, 2025
290a2a4
fix ClusterConfigurationListResult
XiaofeiCao Jul 8, 2025
bee6900
fix tsp validation
XiaofeiCao Jul 8, 2025
34c23b9
fix prettier
XiaofeiCao Jul 8, 2025
f679f15
fix cspell
XiaofeiCao Jul 8, 2025
8298b87
fix tsp validation
XiaofeiCao Jul 8, 2025
c8a0940
fix tsp format
XiaofeiCao Jul 8, 2025
4efdbdd
fix flatten
XiaofeiCao Jul 8, 2025
f9b004a
java config
XiaofeiCao Jul 8, 2025
0f4fa60
tsp validation
XiaofeiCao Jul 8, 2025
696e23b
fix tspconfig.yaml
XiaofeiCao Jul 8, 2025
d9b86a3
fix breaking
XiaofeiCao Jul 8, 2025
f7a7208
fix example model validation
XiaofeiCao Jul 8, 2025
c0dc78f
tsp format
XiaofeiCao Jul 8, 2025
12c1d07
fix example
XiaofeiCao Jul 8, 2025
10a99c7
update
Jul 22, 2025
93bb61a
fix headers
XiaofeiCao Jul 22, 2025
4141a6f
Merge branch 'main' into migrate/postgresqlhsc
XiaofeiCao Aug 8, 2025
1d3f488
use recommended @list
XiaofeiCao Aug 8, 2025
ea2429e
uniqueItems
XiaofeiCao Aug 8, 2025
aa8d622
Merge branch 'main' into migrate/postgresqlhsc
XiaofeiCao Aug 15, 2025
32a60e5
Update tspconfig.yaml
msyyc Aug 15, 2025
631aaab
fix privateendpointconnection
XiaofeiCao Aug 15, 2025
2ca9027
Merge branch 'main' into migrate/postgresqlhsc
v-jiaodi Aug 29, 2025
a412b42
java config
XiaofeiCao Aug 29, 2025
bb2fa84
Remove the csharp config from tspconfig.yaml
HarveyLink Aug 29, 2025
2b38c3c
Merge branch 'migrate/postgresqlhsc' of https://github.com/XiaofeiCao…
HarveyLink Aug 29, 2025
7fce79b
fix lro headers
XiaofeiCao Aug 29, 2025
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
142 changes: 142 additions & 0 deletions specification/postgresqlhsc/PostgresqlHsc.Management/Cluster.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.DBforPostgreSQL;
/**
* Represents a cluster.
*/
model Cluster is Azure.ResourceManager.TrackedResource<ClusterProperties> {
...ResourceNameParameter<
Resource = Cluster,
KeyName = "clusterName",
SegmentName = "serverGroupsv2",
NamePattern = "^(?![0-9]+$)(?!-)[a-z0-9-]{3,40}(?<!-)$"
>;

/**
* Describes the identity of the cluster.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
identity?: IdentityProperties;
}

@armResourceOperations
interface Clusters {
/**
* Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
*/
get is ArmResourceRead<Cluster>;

/**
* Creates a new cluster with servers.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
create is ArmResourceCreateOrReplaceAsync<
Cluster,
LroHeaders = ArmCombinedLroHeaders<FinalResult = Cluster>
>;

/**
* Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@patch(#{ implicitOptionality: false })
@Azure.Core.useFinalStateVia("location")
update is ArmCustomPatchAsync<
Cluster,
PatchModel = ClusterForUpdate,
Response = ArmResponse<Cluster> | (ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders<FinalResult = Cluster>> & {
@bodyRoot
_: Cluster;
})
>;

/**
* Deletes a cluster together with servers in it.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
delete is ArmResourceDeleteWithoutOkAsync<
Cluster,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders> | ArmDeletedNoContentResponse
>;

/**
* Lists all clusters in a resource group.
*/
listByResourceGroup is ArmResourceListByParent<Cluster>;

/**
* Lists all clusters in a subscription.
*/
list is ArmListBySubscription<Cluster>;

/**
* Promotes read replica cluster to an independent read-write cluster.
*/
@action("promote")
@Azure.Core.useFinalStateVia("location")
promoteReadReplica is ArmResourceActionAsyncBase<
Cluster,
PromoteRequest,
ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader &
ArmLroLocationHeader>,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Cluster>,
OptionalRequestBody = true
>;

/**
* Restarts all nodes in the cluster.
*/
@Azure.Core.useFinalStateVia("location")
restart is ArmResourceActionAsyncBase<
Cluster,
void,
ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader &
ArmLroLocationHeader>,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Cluster>
>;

/**
* Starts stopped compute on all cluster nodes.
*/
@Azure.Core.useFinalStateVia("location")
start is ArmResourceActionAsync<
Cluster,
void,
OkResponse,
LroHeaders = ArmAsyncOperationHeader & ArmLroLocationHeader
>;

/**
* Stops compute on all cluster nodes.
*/
@Azure.Core.useFinalStateVia("location")
stop is ArmResourceActionAsync<
Cluster,
void,
OkResponse,
LroHeaders = ArmAsyncOperationHeader & ArmLroLocationHeader
>;
}

@@maxLength(Cluster.name, 40);
@@minLength(Cluster.name, 3);
@@doc(Cluster.name, "The name of the cluster.");
@@doc(Cluster.properties, "Properties of the cluster.");
@@doc(Clusters.create::parameters.resource,
"The required parameters for creating or updating a cluster."
);
@@doc(Clusters.update::parameters.properties,
"The parameters for updating a cluster."
);
@@doc(Clusters.promoteReadReplica::parameters.body,
"The parameter for enabling geo-redundant backup while promoting read replica."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Cluster.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;

namespace Microsoft.DBforPostgreSQL;
/**
* Represents a server in a cluster.
*/
@parentResource(Cluster)
model ClusterServer
is Azure.ResourceManager.ProxyResource<ClusterServerProperties> {
...ResourceNameParameter<
Resource = ClusterServer,
KeyName = "serverName",
SegmentName = "servers",
NamePattern = "^[-\\w\\._]+$"
>;
}

@armResourceOperations
interface Servers {
/**
* Gets information about a server in cluster.
*/
get is ArmResourceRead<ClusterServer>;

/**
* Lists servers of a cluster.
*/
listByCluster is ArmResourceListByParent<
ClusterServer,
Response = ArmResponse<ResourceListResult<ClusterServer>>
>;
}

@@maxLength(ClusterServer.name, 90);
@@minLength(ClusterServer.name, 1);
@@doc(ClusterServer.name, "The name of the server.");
@@doc(ClusterServer.properties, "The properties of a server in a cluster.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Cluster.tsp";

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

namespace Microsoft.DBforPostgreSQL;
/**
* Represents configuration details for coordinator and node.
*/
@parentResource(Cluster)
model Configuration
is Azure.ResourceManager.ProxyResource<ConfigurationProperties> {
...ResourceNameParameter<
Resource = Configuration,
KeyName = "configurationName",
SegmentName = "configurations",
NamePattern = "^[-\\w\\._]+$"
>;
}

@armResourceOperations
interface Configurations {
/**
* Gets information of a configuration for coordinator and nodes.
*/
get is ArmResourceRead<Configuration>;

/**
* List all the configurations of a cluster.
*/
@list
listByCluster is ArmResourceListByParent<
Configuration,
Response = ClusterConfigurationListResult
>;

/**
* List all the configurations of a server in cluster.
*/
@get
@action("configurations")
@list
listByServer is ArmResourceActionSync<
ClusterServer,
void,
ArmResponse<ResourceListResult<ServerConfiguration>>
>;
}

/**
* Pagination result of configurations.
*/
model ClusterConfigurationListResult {
/**
* The list of configurations.
*/
@doc("The list of configurations.")
@pageItems
value?: Configuration[];

/**
* The link to the next page of results.
*/
@doc("The link to the next page of results.")
@nextLink
nextLink?: string;
}

@@maxLength(Configuration.name, 90);
@@minLength(Configuration.name, 1);
@@doc(Configuration.name, "The name of the cluster configuration.");
@@doc(Configuration.properties, "The properties of configuration.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Cluster.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.DBforPostgreSQL;
/**
* Represents a cluster firewall rule.
*/
@parentResource(Cluster)
model FirewallRule
is Azure.ResourceManager.ProxyResource<FirewallRuleProperties, false> {
...ResourceNameParameter<
Resource = FirewallRule,
KeyName = "firewallRuleName",
SegmentName = "firewallRules",
NamePattern = "^[-\\w\\._]+$"
>;
}

@armResourceOperations
interface FirewallRules {
/**
* Gets information about a cluster firewall rule.
*/
get is ArmResourceRead<FirewallRule>;

/**
* Creates a new cluster firewall rule or updates an existing cluster firewall rule.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
FirewallRule,
LroHeaders = ArmAsyncOperationHeader<FinalResult = FirewallRule> &
ArmLroLocationHeader<FinalResult = FirewallRule>
>;

/**
* Deletes a cluster firewall rule.
*/
@Azure.Core.useFinalStateVia("location")
delete is ArmResourceDeleteWithoutOkAsync<
FirewallRule,
LroHeaders = ArmAsyncOperationHeader<FinalResult = FirewallRule> &
ArmLroLocationHeader<FinalResult = FirewallRule>
>;

/**
* Lists all the firewall rules on cluster.
*/
listByCluster is ArmResourceListByParent<
FirewallRule,
Response = ArmResponse<ResourceListResult<FirewallRule>>
>;
}

@@doc(FirewallRule.name, "The name of the cluster firewall rule.");
@@doc(FirewallRule.properties, "The properties of a firewall rule.");
@@doc(FirewallRules.createOrUpdate::parameters.resource,
"The required parameters for creating or updating a firewall rule."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Cluster.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;

namespace Microsoft.DBforPostgreSQL;

model PrivateEndpointConnection is PrivateEndpointConnectionResource;
alias PrivateEndpointOperations = PrivateEndpoints<PrivateEndpointConnection>;

@armResourceOperations
interface PrivateEndpointConnections {
/**
* Gets private endpoint connection.
*/
get is PrivateEndpointOperations.Read<Cluster>;

/**
* Approves or Rejects a private endpoint connection with a given name.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
createOrUpdate is PrivateEndpointOperations.CreateOrReplaceAsync<
Cluster,
LroHeaders = ArmAsyncOperationHeader<FinalResult = PrivateEndpointConnection> &
ArmLroLocationHeader<FinalResult = PrivateEndpointConnection>
>;

/**
* Deletes a private endpoint connection with a given name.
*/
@Azure.Core.useFinalStateVia("location")
delete is PrivateEndpointOperations.DeleteAsync<
Cluster,
LroHeaders = ArmAsyncOperationHeader & ArmLroLocationHeader
>;

/**
* Gets list of private endpoint connections on a cluster.
*/
listByCluster is PrivateEndpointOperations.ListByParent<Cluster>;
}
Loading
Loading