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

[Typespec Migration] servicefabricmanagedclusters #32790

Open
wants to merge 75 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
128878a
initial conversion
iliu816 Feb 19, 2025
75c9617
sorted swaggers
iliu816 Feb 19, 2025
5916f3c
initial generation
iliu816 Feb 19, 2025
1e5e5ce
ManagedCluster supression
iliu816 Feb 20, 2025
8e10d24
managedvmsize, managedclustercodeversionresult, applicationtype
iliu816 Feb 20, 2025
41cd00e
applicationTypeVersions supressions
iliu816 Feb 20, 2025
16f5601
application supression
iliu816 Feb 20, 2025
ccaa7ad
main.tsp: bumping commontype version and adding service operations in…
iliu816 Feb 20, 2025
b47aa6f
nodetype supressions
iliu816 Feb 20, 2025
10282a2
readd @parameterVisibility to ApplicationTypeResource to override pa…
iliu816 Feb 20, 2025
ce8a1f9
serviceresource supression
iliu816 Feb 20, 2025
be8a49e
operationresult, operationstatus supression
iliu816 Feb 21, 2025
52d39b8
first pass cleaning up naming, model links, supressions in models.tsp
iliu816 Feb 21, 2025
d17a1cf
linking client.tsp, changing names of request payload from "propertie…
iliu816 Feb 21, 2025
a3c50c7
removing non-common-type resource models, confirming properties of re…
iliu816 Feb 24, 2025
6eed63f
cleanup remaining linter warnings
iliu816 Feb 24, 2025
4f60214
generated updates to examples
iliu816 Feb 24, 2025
327b498
XMS_EXAMPLE_NOTFOUND_ERROR
iliu816 Feb 25, 2025
b28bfb4
add emitter for sdks
iliu816 Feb 25, 2025
8a5c900
readd example files for old swagger to reduce noise from errors
iliu816 Feb 25, 2025
a612f46
added service-dir default, edits to java and go emitter options
iliu816 Feb 25, 2025
97b0200
RESPONSE_NOT_IN_SPEC, RESPONSE_NOT_IN_EXAMPLE,: removed references to…
iliu816 Feb 25, 2025
dfafe49
remove previous swagger version, readme linter warnings
iliu816 Feb 25, 2025
bdde067
move from common-type v5 to v3 due to armid validation failure
iliu816 Feb 25, 2025
14def47
change eTag to etag
iliu816 Feb 25, 2025
307452c
add url to list operation examples
iliu816 Feb 25, 2025
1d35178
removing requirement on location property for cluster, nodetype, and …
iliu816 Feb 26, 2025
b09971e
better aligning ManagedClusterCodeVersionResult definition with exist…
iliu816 Feb 26, 2025
6bf6dd0
specifying x-ms-parameter-location for operationId parameter
iliu816 Feb 26, 2025
eb4629a
better aligning ManagedVMSize with existing swagger
iliu816 Feb 26, 2025
9b30582
spellcheck omit tsp files, revert managedcluster to trackedresource
iliu816 Feb 26, 2025
8bd4664
prettier check on example files
iliu816 Feb 26, 2025
3062af9
spellcheck omission for tsp files
iliu816 Feb 26, 2025
04c4da5
remove duplicate tags property from managedcluster
iliu816 Feb 26, 2025
dbdaf1b
fix filepath for spellcheck omission for tsp files
iliu816 Feb 26, 2025
a92c54e
lintdiff for readme.md
iliu816 Feb 26, 2025
6ba6162
Lintdiff: SecurityDefinitionsStructure. resource managers not expecte…
iliu816 Feb 27, 2025
18edd7e
LintDiff: DescriptionMustNotBeNodeName
iliu816 Feb 27, 2025
ee9b51a
parent-child relation between ManagedCluster and application models
iliu816 Feb 27, 2025
17fa48c
DescriptionMustNotBeNodeName: SingletonPartitionScheme
iliu816 Feb 27, 2025
09f1970
clean up <*> pattern from docstrings, breaking client generation from…
iliu816 Feb 27, 2025
1b1e4cd
attempt formatting HealthCheckWaitDuration and HealthCheckWaitDuratio…
iliu816 Feb 27, 2025
be93063
remove typespec emitters, brownfield service
iliu816 Feb 27, 2025
062191a
remove duration directives from readme.md
iliu816 Feb 27, 2025
8df62c9
mark durations
iliu816 Feb 27, 2025
274c301
add java and go to sdk in readme.md
iliu816 Feb 28, 2025
f504423
linux is not supported managedcodeversion environment in existing sfm…
iliu816 Feb 28, 2025
11099af
emit final-state-schema for startFaultSimulation and stopFaultSimulat…
iliu816 Feb 28, 2025
4ccfffb
breaking change warnings from go sdk generation
iliu816 Feb 28, 2025
a58f620
breaking change warnings from java sdk generation:
iliu816 Feb 28, 2025
704cb8b
FaultSimulation*Parameters -> FaultSimluation*Content for dotnet SDK …
iliu816 Feb 28, 2025
f9615fa
breaking change warnings from python sdk generation:
iliu816 Mar 1, 2025
22e85ac
breaking change warnings from dotnet sdk generation:
iliu816 Mar 3, 2025
ebdc9df
breaking changes warnings from dotnet sdk generation:
iliu816 Mar 3, 2025
5abdffd
readd non-dotnet emitters to validate sdk generation
iliu816 Mar 4, 2025
aa2f482
Merge branch 'main' into user/iliu/2024-11-01-preview-migrate
mikeharder Mar 4, 2025
bb4890a
breaking changes in go sdk from tspconfig:
iliu816 Mar 5, 2025
ebb839c
tsp formatting fix
iliu816 Mar 5, 2025
cbcd038
breaking changes in go sdk from tspconfig:
iliu816 Mar 5, 2025
a090b99
revert
iliu816 Mar 5, 2025
dbb3ae9
breaking changes in go sdk from tspconfig:
iliu816 Mar 5, 2025
c7fe99c
add back-compat to main.tsp
iliu816 Mar 5, 2025
4ea02dc
typespec validation: emitter configs, formatting
iliu816 Mar 5, 2025
c8f27c3
Merge branch 'main' into user/iliu/2024-11-01-preview-migrate
iliu816 Mar 5, 2025
d2ef26f
typespec version upgrade: fixing warnings
iliu816 Mar 5, 2025
b410d6a
litndiff:
iliu816 Mar 6, 2025
8351ea3
breaking changes in go sdk:
iliu816 Mar 6, 2025
9c92028
double-checking required properties for models, readd capacity as req…
iliu816 Mar 6, 2025
596c316
spellcheck: provisiong -> provisioning
iliu816 Mar 6, 2025
92f1f46
lintdiff: RequiredPropertiesMissingInResourceModel, PatchBodyParamet…
iliu816 Mar 6, 2025
1dbcf71
* remove unused legacy.tsp added by converter tool
iliu816 Mar 7, 2025
4aea569
sorted model types
iliu816 Mar 7, 2025
40d60a1
align PublicIPAddressConfiguration with existing spec
iliu816 Mar 7, 2025
3ecd7b8
dotnet: add backcompat model name for PublicIPAddressConfiguration
iliu816 Mar 7, 2025
6adc0d3
tsp-client compare: minValues, defaults
iliu816 Mar 8, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,356 @@
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;

namespace Microsoft.ServiceFabric;
/**
* The application resource.
*/
@parentResource(ManagedCluster)
model ApplicationResource
is Azure.ResourceManager.ProxyResource<ApplicationResourceProperties> {
...ResourceNameParameter<
Resource = ApplicationResource,
KeyName = "applicationName",
SegmentName = "applications",
NamePattern = ""
>;
...Azure.ResourceManager.Foundations.ArmTagsProperty;

/**
* Describes the managed identities for an Azure resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Backwards compatibility with existing spec"
identity?: ManagedIdentity;

/**
* The geo-location where the resource lives
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Day 0 Property"
@visibility(Lifecycle.Create, Lifecycle.Read)
location?: string;
}

@armResourceOperations
interface Applications {
/**
* Get a Service Fabric managed application resource created or in the process of being created in the Service Fabric cluster resource.
*/
get is ArmResourceRead<ApplicationResource>;

/**
* Create or update a Service Fabric managed application resource with the specified name.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "Day 0 Property"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "Day 0 Property"
createOrUpdate is ArmResourceCreateOrUpdateAsync<
ApplicationResource,
Response = ArmResourceUpdatedResponse<ApplicationResource> | (ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders<FinalResult = ApplicationResource>> & {
@bodyRoot
_: ApplicationResource;
})
>;

/**
* Updates the tags of an application resource of a given managed cluster.
*/
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchSync<
ApplicationResource,
PatchModel = ApplicationUpdateParameters
>;

/**
* Delete a Service Fabric managed application resource with the specified name.
*/
delete is ArmResourceDeleteWithoutOkAsync<
ApplicationResource,
Response = ArmDeleteAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders> | ArmDeletedNoContentResponse
>;

/**
* Gets all managed application resources created or in the process of being created in the Service Fabric cluster resource.
*/
list is ArmResourceListByParent<
ApplicationResource,
Response = ArmResponse<ApplicationResourceList>
>;

/**
* Get the status of the latest application upgrade. It will query the cluster to find the status of the latest application upgrade.
*/
@action("fetchUpgradeStatus")
readUpgrade is ArmResourceActionAsync<
ApplicationResource,
void,
never,
LroHeaders = ArmCombinedLroHeaders
>;

/**
* Send a request to resume the current application upgrade. This will resume the application upgrade from where it was paused.
*/
resumeUpgrade is ArmResourceActionAsync<
ApplicationResource,
RuntimeResumeApplicationUpgradeParameters,
never,
LroHeaders = ArmCombinedLroHeaders
>;

/**
* Send a request to start a rollback of the current application upgrade. This will start rolling back the application to the previous version.
*/
startRollback is ArmResourceActionAsync<
ApplicationResource,
void,
never,
LroHeaders = ArmCombinedLroHeaders
>;
}

@@doc(ApplicationResource.name, "The name of the application resource.");
@@doc(ApplicationResource.properties, "The application resource properties.");
@@doc(Applications.createOrUpdate::parameters.resource,
"The application resource."
);
@@doc(Applications.update::parameters.properties,
"The application resource updated tags."
);
@@doc(Applications.resumeUpgrade::parameters.body,
"The parameters for resuming an application upgrade."
);

/**
* The application resource properties.
*/
model ApplicationResourceProperties {
/**
* The current deployment or provisioning state, which only appears in the response
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Day 0 property, keep as string for backwards compatibility"
@visibility(Lifecycle.Read)
provisioningState?: string;

/**
* The version of the application type as defined in the application manifest.
* This name must be the full Arm Resource ID for the referenced application type version.
*
*/
version?: string;

/**
* List of application parameters with overridden values from their default values specified in the application manifest.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "Day 0 property, used to pass string to string dictionary"
parameters?: Record<string>;

/**
* Describes the policy for a monitored application upgrade.
*/
upgradePolicy?: ApplicationUpgradePolicy;

/**
* List of user assigned identities for the application, each mapped to a friendly name.
*/
@OpenAPI.extension("x-ms-identifiers", #[])
managedIdentities?: ApplicationUserAssignedIdentity[];
}

/**
* The list of application resources.
*/
model ApplicationResourceList is Azure.Core.Page<ApplicationResource>;

/**
* Describes the policy for a monitored application upgrade.
*/
model ApplicationUpgradePolicy {
/**
* Defines a health policy used to evaluate the health of an application or one of its children entities.
*
*/
applicationHealthPolicy?: ApplicationHealthPolicy;

/**
* If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data).
*/
forceRestart?: boolean = false;

/**
* The policy used for monitoring the application upgrade
*/
rollingUpgradeMonitoringPolicy?: RollingUpgradeMonitoringPolicy;

/**
* Duration in seconds, to wait before a stateless instance is closed, to allow the active requests to drain gracefully. This would be effective when the instance is closing during the application/cluster upgrade, only for those instances which have a non-zero delay duration configured in the service description.
*/
instanceCloseDelayDuration?: int64;

/**
* The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto.
*/
upgradeMode?: RollingUpgradeMode;

/**
* The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer).
*/
upgradeReplicaSetCheckTimeout?: int64;

/**
* Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed.
*/
recreateApplication?: boolean;
}

/**
* Defines a health policy used to evaluate the health of an application or one of its children entities.
*
*/
model ApplicationHealthPolicy {
/**
* Indicates whether warnings are treated with the same severity as errors.
*/
considerWarningAsError: boolean;

/**
* The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100.
* The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error.
* This is calculated by dividing the number of unhealthy deployed applications over the number of nodes where the application is currently deployed on in the cluster.
* The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero.
*
*/
maxPercentUnhealthyDeployedApplications: int32;

/**
* The health policy used by default to evaluate the health of a service type.
*/
defaultServiceTypeHealthPolicy?: ServiceTypeHealthPolicy;

/**
* The map with service type health policy per service type name. The map is empty by default.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "Day 0 property, used to pass string to ServiceTypeHealthPolicy dictionary"
serviceTypeHealthPolicyMap?: Record<ServiceTypeHealthPolicy>;
}

/**
* User assigned identity for the application.
*/
model ApplicationUserAssignedIdentity {
/**
* The friendly name of user assigned identity.
*/
name: string;

/**
* The principal id of user assigned identity.
*/
principalId: string;
}

/**
* Application update request.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/patch-envelope" "Not adding identity property as this API is for updating tags only"
model ApplicationUpdateParameters {
/**
* Application update parameters
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "Day 0 property, used to pass string to string dictionary"
tags?: Record<string>;
}

/**
* The policy used for monitoring the application upgrade
*/
model RollingUpgradeMonitoringPolicy {
/**
* The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations. Invalid indicates the failure action is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode.
*/
failureAction: FailureAction;

/**
* The amount of time to wait after completing an upgrade domain before applying health policies. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff".
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Day 0 property"
@OpenAPI.extension("x-ms-format", "duration-constant")
healthCheckWaitDuration: string;

/**
* The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff".
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Day 0 property"
@OpenAPI.extension("x-ms-format", "duration-constant")
healthCheckStableDuration: string;

/**
* The amount of time to retry health evaluation when the application or cluster is unhealthy before FailureAction is executed. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff".
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Day 0 property"
@OpenAPI.extension("x-ms-format", "duration-constant")
healthCheckRetryTimeout: string;

/**
* The amount of time the overall upgrade has to complete before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff".
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Day 0 property"
@OpenAPI.extension("x-ms-format", "duration-constant")
upgradeTimeout: string;

/**
* The amount of time each upgrade domain has to complete before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff".
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Day 0 property"
@OpenAPI.extension("x-ms-format", "duration-constant")
upgradeDomainTimeout: string;
}

/**
* The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations. Invalid indicates the failure action is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode.
*/
union FailureAction {
string,

/**
* Indicates that a rollback of the upgrade will be performed by Service Fabric if the upgrade fails.
*/
Rollback: "Rollback",

/**
* Indicates that a manual repair will need to be performed by the administrator if the upgrade fails. Service Fabric will not proceed to the next upgrade domain automatically.
*/
Manual: "Manual",
}

/**
* The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto.
*/
union RollingUpgradeMode {
string,

/**
* The upgrade will stop after completing each upgrade domain and automatically monitor health before proceeding. The value is 0.
*/
Monitored: "Monitored",

/**
* The upgrade will proceed automatically without performing any health monitoring. The value is 1.
*/
UnmonitoredAuto: "UnmonitoredAuto",
}

/**
* Parameters for Resume Upgrade action. The upgrade domain name must be specified.
*/
model RuntimeResumeApplicationUpgradeParameters {
/**
* The upgrade domain name. Expected to be the next upgrade domain if the application is upgrading.
*/
upgradeDomainName?: string;
}
Loading
Loading