Skip to content

Convert Help swagger to Tsp #34311

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
57 changes: 57 additions & 0 deletions specification/help/Help.Management/DiagnosticResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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.Help;
/**
* Diagnostic resource
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-base-parameter" "For backward compatibility"
@extensionResource
model DiagnosticResource
is Azure.ResourceManager.ExtensionResource<DiagnosticResourceProperties> {
...ResourceNameParameter<
Resource = DiagnosticResource,
KeyName = "diagnosticsResourceName",
SegmentName = "diagnostics",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

@armResourceOperations
interface DiagnosticResources {
/**
* Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Diagnostics_Get")
get is ArmResourceRead<
DiagnosticResource,
BaseParameters = ScopeParameters<DiagnosticResource>
>;

/**
* Creates a diagnostic for the specific resource using solutionId from discovery solutions. <br/>Diagnostics are powerful solutions that access product resources or other relevant data and provide the root cause of the issue and the steps to address the issue.<br/><br/>
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Diagnostics_Create")
create is ArmResourceCreateOrReplaceAsync<
DiagnosticResource,
BaseParameters = ScopeParameters<DiagnosticResource>
>;
}

@@maxLength(DiagnosticResource.name, 100);
@@minLength(DiagnosticResource.name, 1);
@@doc(DiagnosticResource.name, "Unique resource name for insight resources");
@@doc(DiagnosticResource.properties, "Diagnostic Resource properties.");
@@doc(DiagnosticResources.create::parameters.resource,
"The required request body for this insightResource invocation."
);
57 changes: 57 additions & 0 deletions specification/help/Help.Management/SimplifiedSolutionsResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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.Help;
/**
* Simplified Solutions response.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-base-parameter" "For backward compatibility"
@extensionResource
model SimplifiedSolutionsResource
is Azure.ResourceManager.ExtensionResource<SimplifiedSolutionsResourceProperties> {
...ResourceNameParameter<
Resource = SimplifiedSolutionsResource,
KeyName = "simplifiedSolutionsResourceName",
SegmentName = "simplifiedSolutions",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

@armResourceOperations
interface SimplifiedSolutionsResources {
/**
* Get the simplified Solutions using the applicable solutionResourceName while creating the simplified Solutions.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("SimplifiedSolutions_Get")
get is ArmResourceRead<
SimplifiedSolutionsResource,
BaseParameters = ScopeParameters<SimplifiedSolutionsResource>
>;

/**
* Creates Simplified Solutions for an Azure subscription using 'solutionId' from Discovery Solutions as the input. <br/><br/> Simplified Solutions API makes the consumption of solutions APIs easier while still providing access to the same powerful solutions rendered in Solutions API. With Simplified Solutions, users don't have to worry about stitching together the article using replacement maps and can use the content in the API response to directly render as HTML content.<br/>
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("SimplifiedSolutions_Create")
create is ArmResourceCreateOrReplaceAsync<
SimplifiedSolutionsResource,
BaseParameters = ScopeParameters<SimplifiedSolutionsResource>
>;
}

@@maxLength(SimplifiedSolutionsResource.name, 100);
@@minLength(SimplifiedSolutionsResource.name, 1);
@@doc(SimplifiedSolutionsResource.name, "Simplified Solutions Resource Name.");
@@doc(SimplifiedSolutionsResource.properties, "Simplified Solutions result");
@@doc(SimplifiedSolutionsResources.create::parameters.resource,
"The required request body for simplified Solutions resource creation."
);
96 changes: 96 additions & 0 deletions specification/help/Help.Management/SolutionResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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.Help;
/**
* Solution response.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-base-parameter" "For backward compatibility"
@extensionResource
model SolutionResource
is Azure.ResourceManager.ExtensionResource<SolutionResourceProperties> {
...ResourceNameParameter<
Resource = SolutionResource,
KeyName = "solutionResourceName",
SegmentName = "solutions",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

@armResourceOperations
interface SolutionResources {
/**
* Get the solution using the applicable solutionResourceName while creating the solution.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Solution_Get")
get is ArmResourceRead<
SolutionResource,
BaseParameters = ScopeParameters<SolutionResource>
>;

/**
* Creates a solution for the specific Azure resource or subscription using the inputs ‘solutionId and requiredInputs’ from discovery solutions. <br/> Azure solutions comprise a comprehensive library of self-help resources that have been thoughtfully curated by Azure engineers to aid customers in resolving typical troubleshooting issues. These solutions encompass: <br/> (1.) Dynamic and context-aware diagnostics, guided troubleshooting wizards, and data visualizations. <br/> (2.) Rich instructional video tutorials and illustrative diagrams and images. <br/> (3.) Thoughtfully assembled textual troubleshooting instructions. <br/> All these components are seamlessly converged into unified solutions tailored to address a specific support problem area.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Solution_Create")
create is ArmResourceCreateOrReplaceAsync<
SolutionResource,
BaseParameters = ScopeParameters<SolutionResource>
>;

/**
* Update the requiredInputs or additional information needed to execute the solution
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@patch(#{ implicitOptionality: false })
@operationId("Solution_Update")
update is ArmCustomPatchAsync<
SolutionResource,
PatchModel = SolutionPatchRequestBody,
BaseParameters = ScopeParameters<SolutionResource>,
Response = ArmResourceUpdatedResponse<SolutionResource> | (ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = SolutionResource>> & {
@bodyRoot
_: SolutionResource;
})
>;

/**
* Warm up the solution resource by preloading asynchronous diagnostics results into cache
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@action("warmup")
@operationId("Solution_WarmUp")
warmUp is ArmResourceActionSync<
SolutionResource,
{
/**
* The required request body for warming up a solution resource.
*/
@bodyRoot
solutionWarmUpRequestBody?: SolutionWarmUpRequestBody;
},
NoContentResponse,
BaseParameters = ScopeParameters<SolutionResource>
>;
}

@@maxLength(SolutionResource.name, 100);
@@minLength(SolutionResource.name, 1);
@@doc(SolutionResource.name, "Solution resource Name.");
@@doc(SolutionResource.properties, "Solution result");
@@doc(SolutionResources.create::parameters.resource,
"The required request body for this solution resource creation."
);
@@doc(SolutionResources.update::parameters.properties,
"The required request body for updating a solution resource."
);
45 changes: 45 additions & 0 deletions specification/help/Help.Management/SolutionResourceSelfHelp.tsp
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";

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

namespace Microsoft.Help;
/**
* Self Help Solution response.
*/
@tenantResource
model SolutionResourceSelfHelp
is Azure.ResourceManager.ProxyResource<SolutionsResourcePropertiesSelfHelp> {
...ResourceNameParameter<
Resource = SolutionResourceSelfHelp,
KeyName = "solutionId",
SegmentName = "selfHelp",
NamePattern = ""
>;
}

@armResourceOperations
interface SolutionResourceSelfHelps {
/**
* Gets Self Help Solutions for a given solutionId. Self Help Solutions consist of rich instructional video tutorials, links and guides to public documentation related to a specific problem that enables users to troubleshoot Azure issues.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("SolutionSelfHelp_Get")
get is ArmResourceRead<
SolutionResourceSelfHelp,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters
>;
}

@@maxLength(SolutionResourceSelfHelp.name, 100);
@@minLength(SolutionResourceSelfHelp.name, 1);
@@doc(SolutionResourceSelfHelp.name,
"SolutionId is a unique id to identify a solution. You can retrieve the solution id using the Discovery api - https://learn.microsoft.com/en-us/rest/api/help/discovery-solution/list?view=rest-help-2023-09-01-preview&tabs=HTTP"
);
@@doc(SolutionResourceSelfHelp.properties, "Solution result");
99 changes: 99 additions & 0 deletions specification/help/Help.Management/TroubleshooterResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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.Help;
/**
* Troubleshooter response.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-base-parameter" "For backward compatibility"
@extensionResource
model TroubleshooterResource
is Azure.ResourceManager.ExtensionResource<TroubleshooterInstanceProperties> {
...ResourceNameParameter<
Resource = TroubleshooterResource,
KeyName = "troubleshooterName",
SegmentName = "troubleshooters",
NamePattern = "([A-Za-z0-9]+(-[A-Za-z0-9]+)+)"
>;
}

@armResourceOperations
interface TroubleshooterResources {
/**
* Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Troubleshooters_Get")
get is ArmResourceRead<
TroubleshooterResource,
BaseParameters = ScopeParameters<TroubleshooterResource>
>;

/**
* Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Azure Troubleshooters help with hard to classify issues, reducing the gap between customer observed problems and solutions by guiding the user effortlessly through the troubleshooting process. Each Troubleshooter flow represents a problem area within Azure and has a complex tree-like structure that addresses many root causes. These flows are prepared with the help of Subject Matter experts and customer support engineers by carefully considering previous support requests raised by customers. Troubleshooters terminate at a well curated solution based off of resource backend signals and customer manual selections.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Troubleshooters_Create")
create is ArmResourceCreateOrReplaceSync<
TroubleshooterResource,
BaseParameters = ScopeParameters<TroubleshooterResource>
>;

/**
* Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Troubleshooters_Continue")
continue is ArmResourceActionSync<
TroubleshooterResource,
{
/**
* The required request body for going to next step in Troubleshooter resource.
*/
@bodyRoot
continueRequestBody?: ContinueRequestBody;
},
NoContentResponse,
BaseParameters = ScopeParameters<TroubleshooterResource>
>;

/**
* Ends the troubleshooter action
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Troubleshooters_End")
end is ArmResourceActionSync<
TroubleshooterResource,
void,
NoContentResponse,
BaseParameters = ScopeParameters<TroubleshooterResource>
>;

/**
* Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Troubleshooters_Restart")
restart is ArmResourceActionSync<
TroubleshooterResource,
void,
ArmResponse<RestartTroubleshooterResponse>,
BaseParameters = ScopeParameters<TroubleshooterResource>
>;
}

@@maxLength(TroubleshooterResource.name, 100);
@@minLength(TroubleshooterResource.name, 1);
@@doc(TroubleshooterResource.name, "Troubleshooter resource Name.");
@@doc(TroubleshooterResource.properties, "Troubleshooter Instance properties.");
@@doc(TroubleshooterResources.create::parameters.resource,
"The required request body for this Troubleshooter resource creation."
);
Loading
Loading