Skip to content
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
179 changes: 179 additions & 0 deletions specification/solutions/Solutions.Management/Application.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
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.Solutions;
/**
* Information about managed application.
*/
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@Http.Private.includeInapplicableMetadataInPayload(false)
model Application extends GenericResource {
@visibility(Lifecycle.Read)
@path
@key("applicationName")
@minLength(3)
@maxLength(64)
@segment("applications")
name: string;

/**
* The managed application properties.
*/
properties: ApplicationProperties;

/**
* The plan information.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
plan?: Plan;

/**
* The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@pattern("^[-\\w\\._,\\(\\)]+$")
kind: string;

/**
* The identity of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
identity?: Identity;
}

@armResourceOperations
interface Applications {
/**
* Gets the managed application.
*/
get is ArmResourceRead<
Application,
Response = ArmResponse<Application> | NotFoundResponse
>;

/**
* Creates or updates a managed application.
*/
createOrUpdate is ArmResourceCreateOrReplaceAsync<Application>;

/**
* Updates an existing managed application.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@patch(#{ implicitOptionality: false })
update is Azure.ResourceManager.Legacy.CustomPatchAsync<
Application,
PatchModel = ApplicationPatchable,
Response =
| ArmResponse<Application>
| (ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = Application> &
Azure.Core.Foundations.RetryAfterHeader> & {
@bodyRoot
_: Application;
}),
OptionalRequestBody = true
>;

/**
* Deletes the managed application.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
delete is ArmResourceDeleteWithoutOkAsync<
Application,
Response =
| ArmDeletedResponse
| ArmDeleteAcceptedLroResponse<ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader>
| ArmDeletedNoContentResponse
>;

/**
* Lists all the applications within a resource group.
*/
listByResourceGroup is ArmResourceListByParent<Application>;

/**
* Lists all the applications within a subscription.
*/
listBySubscription is ArmListBySubscription<Application>;

/**
* Refresh Permissions for application.
*/
refreshPermissions is ArmResourceActionAsyncBase<
Application,
void,
OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader>,
Azure.ResourceManager.Foundations.BaseParameters<Application>
>;

/**
* List allowed upgrade plans for application.
*/
listAllowedUpgradePlans is ArmResourceActionSync<
Application,
void,
ArmResponse<AllowedUpgradePlansResult>
>;

/**
* Update access for application.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
updateAccess is ArmResourceActionAsyncBase<
Application,
UpdateAccessDefinition,

| OkResponse
| (ArmAcceptedLroResponse<
"Resource operation accepted.",
ArmLroLocationHeader<FinalResult = UpdateAccessDefinition> &
Azure.Core.Foundations.RetryAfterHeader
> &
Body<UpdateAccessDefinition>),
BaseParameters = Azure.ResourceManager.Foundations.BaseParameters<Application>
>;

/**
* List tokens for application.
*/
listTokens is ArmResourceActionSync<
Application,
ListTokenRequest,
ArmResponse<ManagedIdentityTokenResult>
>;
}

@@maxLength(Application.name, 64);
@@minLength(Application.name, 3);
@@doc(Application.name, "The name of the managed application.");
@@doc(Application.properties, "The managed application properties.");
@@doc(
Applications.createOrUpdate::parameters.resource,
"Parameters supplied to the create or update a managed application."
);
@@doc(
Applications.update::parameters.properties,
"Parameters supplied to update an existing managed application."
);
@@doc(
Applications.updateAccess::parameters.body,
"Request body parameters to update access."
);
@@doc(
Applications.listTokens::parameters.body,
"Request body parameters to list tokens."
);
155 changes: 155 additions & 0 deletions specification/solutions/Solutions.Management/ApplicationDefinition.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
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.Solutions;
/**
* Information about managed application definition.
*/
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@Http.Private.includeInapplicableMetadataInPayload(false)
model ApplicationDefinition extends GenericResource {
@visibility(Lifecycle.Read)
@path
@key("applicationDefinitionName")
@minLength(2)
@maxLength(10)
@segment("applicationDefinitions")
name: string;

/**
* The managed application definition properties that can be updated.
*/
properties: ApplicationDefinitionProperties;
}

alias ApplicationDefinitionOps = Azure.ResourceManager.Legacy.RoutedOperations<
{
...ApiVersionParameter;
...SubscriptionIdParameter;
...ResourceGroupParameter;
},
{
/** The name of the managed application definition. */
@path
@key
@minLength(3)
@maxLength(64)
@segment("applicationDefinitions")
applicationDefinitionName: string;
},
ResourceRoute = #{ useStaticRoute: true }
>;

@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}")
@armResourceOperations(#{ allowStaticRoutes: true })
interface ApplicationDefinitions {
/**
* Gets the managed application definition.
*/
@sharedRoute
get is ApplicationDefinitionOps.Read<
ApplicationDefinition,
Response = ArmResponse<ApplicationDefinition> | NotFoundResponse
>;

/**
* Creates or updates a managed application definition.
*/
@sharedRoute
createOrUpdate is ApplicationDefinitionOps.CreateOrUpdateSync<ApplicationDefinition>;

/**
* Updates the managed application definition.
*/
@sharedRoute
@patch(#{ implicitOptionality: false })
update is ApplicationDefinitionOps.CustomPatchSync<
ApplicationDefinition,
PatchModel = ApplicationDefinitionPatchable
>;

/**
* Deletes the managed application definition.
*/
@sharedRoute
delete is ApplicationDefinitionOps.DeleteSync<ApplicationDefinition>;
}

@tag("ApplicationDefinitions")
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}?disambiguation_dummy")
@armResourceOperations(#{ allowStaticRoutes: true, omitTags: true })
interface ApplicationDefinitionOpsById {
/**
* Gets the managed application definition.
*/
@sharedRoute
getById is ApplicationDefinitionOps.Read<
ApplicationDefinition,
Response = ArmResponse<ApplicationDefinition> | NotFoundResponse
>;

/**
* Creates or updates a managed application definition.
*/
@sharedRoute
createOrUpdateById is ApplicationDefinitionOps.CreateOrUpdateSync<ApplicationDefinition>;

/**
* Updates the managed application definition.
*/
@sharedRoute
@patch(#{ implicitOptionality: false })
updateById is ApplicationDefinitionOps.CustomPatchSync<
ApplicationDefinition,
PatchModel = ApplicationDefinitionPatchable
>;

/**
* Deletes the managed application definition.
*/
@sharedRoute
deleteById is ApplicationDefinitionOps.DeleteSync<ApplicationDefinition>;
}

@armResourceOperations(#{ omitTags: true })
@tag("ApplicationDefinitions")
interface ApplicationDefinitionListOperationGroup {
/**
* Lists the managed application definitions in a resource group.
*/
listByResourceGroup is ArmResourceListByParent<ApplicationDefinition>;

/**
* Lists all the application definitions within a subscription.
*/
listBySubscription is ArmListBySubscription<ApplicationDefinition>;
}

@@maxLength(ApplicationDefinition.name, 64);
@@minLength(ApplicationDefinition.name, 3);
@@doc(
ApplicationDefinition.name,
"The name of the managed application definition."
);
@@doc(
ApplicationDefinition.properties,
"The managed application definition properties."
);
@@doc(
ApplicationDefinitions.createOrUpdate::parameters.resource,
"Parameters supplied to the create or update an managed application definition."
);
@@doc(
ApplicationDefinitions.update::parameters.properties,
"Parameters supplied to the update a managed application definition."
);
Loading
Loading