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,112 @@
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.BareMetalInfrastructure;
/**
* AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties)
*/
model AzureBareMetalInstance
is Azure.ResourceManager.TrackedResource<AzureBareMetalInstanceProperties> {
...ResourceNameParameter<
Resource = AzureBareMetalInstance,
KeyName = "azureBareMetalInstanceName",
SegmentName = "bareMetalInstances",
NamePattern = "^[a-zA-Z0-9]+$"
>;
}

@armResourceOperations
interface AzureBareMetalInstances {
/**
* Gets an Azure Bare Metal Instance for the specified subscription, resource group, and instance name.
*/
get is ArmResourceRead<AzureBareMetalInstance>;

/**
* Creates an Azure Bare Metal Instance for the specified subscription, resource group, and instance name.
*/
create is ArmResourceCreateOrReplaceSync<AzureBareMetalInstance>;

/**
* Patches the Tags field of a Azure Bare Metal Instance for the specified subscription, resource group, and instance name.
*/
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchSync<AzureBareMetalInstance, PatchModel = Tags>;

/**
* Deletes an Azure Bare Metal Instance for the specified subscription, resource group, and instance name.
*/
delete is ArmResourceDeleteSync<AzureBareMetalInstance>;

/**
* Gets a list of Azure Bare Metal Instances in the specified subscription and resource group. The operations returns various properties of each Azure Bare Metal Instance.
*/
listByResourceGroup is ArmResourceListByParent<AzureBareMetalInstance>;

/**
* Returns a list of Azure Bare Metal Instances in the specified subscription. The operations returns various properties of each Azure Bare Metal Instance.
*/
listBySubscription is ArmListBySubscription<AzureBareMetalInstance>;

/**
* The operation to start an Azure Bare Metal instance
*/
start is ArmResourceActionAsync<
AzureBareMetalInstance,
void,
ArmResponse<OperationStatus>
>;

/**
* The operation to restart an Azure Bare Metal Instance
*/
restart is ArmResourceActionAsync<
AzureBareMetalInstance,
{
/**
* When set to 'active', this parameter empowers the server with the ability to forcefully terminate and halt any existing processes that may be running on the server
*/
@bodyRoot
forceParameter?: ForceState;
},
ArmResponse<OperationStatus>
>;

/**
* The operation to shutdown an Azure Bare Metal Instance
*/
shutdown is ArmResourceActionAsync<
AzureBareMetalInstance,
void,
ArmResponse<OperationStatus>
>;
}

@@doc(AzureBareMetalInstance.name,
"Name of the Azure Bare Metal Instance, also known as the ResourceName."
);
@@doc(AzureBareMetalInstance.properties, "AzureBareMetal instance properties");
@@doc(AzureBareMetalInstances.update::parameters.properties,
"Request body that only contains the new Tags field"
);
@@summary(AzureBareMetalInstances.listBySubscription,
"Returns a list of Azure Bare Metal Instances in the specified subscription."
);
@@summary(AzureBareMetalInstances.listByResourceGroup,
"Gets a list of Azure Bare Metal Instances in the specified subscription and resource group."
);
@@summary(AzureBareMetalInstances.get, "Gets an Azure Bare Metal Instance.");
@@summary(AzureBareMetalInstances.update,
"Patches the Tags field of a Azure Bare Metal Instance."
);
@@summary(AzureBareMetalInstances.restart, "Restart a Bare Metal Instance.");
@@summary(AzureBareMetalInstances.shutdown, "Shutdown a Bare Metal Instance.");
@@summary(AzureBareMetalInstances.start, "Start a Bare Metal Instance.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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.BareMetalInfrastructure;
/**
* AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties)
*/
model AzureBareMetalStorageInstance
is Azure.ResourceManager.TrackedResource<AzureBareMetalStorageInstanceProperties> {
...ResourceNameParameter<
Resource = AzureBareMetalStorageInstance,
KeyName = "azureBareMetalStorageInstanceName",
SegmentName = "bareMetalStorageInstances",
NamePattern = ".*"
>;

/**
* The identity of Azure Bare Metal Storage Instance, if configured.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
identity?: AzureBareMetalStorageInstanceIdentity;
}

@armResourceOperations
interface AzureBareMetalStorageInstances {
/**
* Gets an Azure Bare Metal Storage instance for the specified subscription, resource group, and instance name.
*/
get is ArmResourceRead<AzureBareMetalStorageInstance>;

/**
* Creates an Azure Bare Metal Storage Instance for the specified subscription, resource group, and instance name.
*/
create is ArmResourceCreateOrReplaceSync<AzureBareMetalStorageInstance>;

/**
* Patches the Tags field of a Azure BareMetalStorage instance for the specified subscription, resource group, and instance name.
*/
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchSync<
AzureBareMetalStorageInstance,
PatchModel = AzureBareMetalStorageInstanceBody
>;

/**
* Deletes an Azure Bare Metal Storage Instance for the specified subscription, resource group, and instance name.
*/
delete is ArmResourceDeleteSync<AzureBareMetalStorageInstance>;

/**
* Gets a list of AzureBareMetalStorage instances in the specified subscription and resource group. The operations returns various properties of each Azure Bare Metal Instance.
*/
listByResourceGroup is ArmResourceListByParent<AzureBareMetalStorageInstance>;

/**
* Gets a list of AzureBareMetalStorage instances in the specified subscription. The operations returns various properties of each Azure Bare Metal Instance.
*/
listBySubscription is ArmListBySubscription<AzureBareMetalStorageInstance>;
}

@@doc(AzureBareMetalStorageInstance.name,
"Name of the Azure Bare Metal Storage Instance, also known as the ResourceName."
);
@@doc(AzureBareMetalStorageInstance.properties,
"AzureBareMetalStorageInstance properties"
);
@@doc(AzureBareMetalStorageInstances.create::parameters.resource,
"request body for put call"
);
@@doc(AzureBareMetalStorageInstances.update::parameters.properties,
"Request body that only contains the Tags and Identity Field"
);
@@summary(AzureBareMetalStorageInstances.listByResourceGroup,
"Gets a list of Azure Bare Metal Storage instances in the specified subscription and resource group."
);
@@summary(AzureBareMetalStorageInstances.listBySubscription,
"Gets a list of Azure Bare Metal Storage instances in the specified subscription."
);
@@summary(AzureBareMetalStorageInstances.get,
"Gets an Azure Bare Metal Storage instance."
);
@@summary(AzureBareMetalStorageInstances.create,
"Create an azure bare metal storage resource."
);
@@summary(AzureBareMetalStorageInstances.update,
"Patches the Tags field of a Azure BareMetalStorage instance."
);
@@summary(AzureBareMetalStorageInstances.delete,
"Delete an AzureBareMetalStorageInstance."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Microsoft.BareMetalInfrastructure;

@@clientName(AzureBareMetalInstances.create::parameters.resource,
"requestBodyParameters"
);
@@clientName(AzureBareMetalInstances.update::parameters.properties,
"tagsParameter"
);
#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(AzureBareMetalInstance.properties);

@@clientName(AzureBareMetalStorageInstances.create::parameters.resource,
"requestBodyParameters"
);
@@clientName(AzureBareMetalStorageInstances.update::parameters.properties,
"azureBareMetalStorageInstanceBodyParameter"
);
#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(AzureBareMetalStorageInstance.properties);
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{

Check failure on line 1 in specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Create.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Create.json#L1

specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Create.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Create.json
"operationId": "AzureBareMetalInstances_Create",
"parameters": {
"api-version": "2024-08-01-preview",
"azureBareMetalInstanceName": "myBMIInstance",
"requestBodyParameters": {
"location": "westus",
"properties": {
"azureBareMetalInstanceId": "23415635-4d7e-41dc-9598-8194f22c24e1",
"hardwareProfile": {
"azureBareMetalInstanceSize": "S72",
"hardwareType": "Cisco_UCS"
},
"hwRevision": "Rev 3",
"networkProfile": {
"circuitId": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit",
"networkInterfaces": [
{
"ipAddress": "100.100.100.100"
}
]
},
"osProfile": {
"computerName": "myComputerName",
"osType": "SUSE",
"sshPublicKey": "{ssh-rsa public key}",
"version": "12 SP1"
},
"powerState": "started",
"proximityPlacementGroup": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup",
"storageProfile": {
"nfsIpAddress": "200.200.200.200"
}
},
"tags": {
"testkey": "testvalue"
}
},
"resourceGroupName": "myResourceGroup",
"subscriptionId": "f0f4887f-d13c-4943-a8ba-d7da28d2a3fd"
},
"title": "AzureBareMetalInstances_Create",
"responses": {
"200": {
"body": {
"name": "myBMIInstance",
"type": "Microsoft.BareMetalInfrastructure/bareMetalInstances",
"id": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myBMIInstance",
"location": "westus",
"properties": {
"azureBareMetalInstanceId": "23415635-4d7e-41dc-9598-8194f22c24e1",
"hardwareProfile": {
"azureBareMetalInstanceSize": "S72",
"hardwareType": "Cisco_UCS"
},
"hwRevision": "Rev 3",
"networkProfile": {
"circuitId": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit",
"networkInterfaces": [
{
"ipAddress": "100.100.100.100"
}
]
},
"osProfile": {
"computerName": "myComputerName",
"osType": "SUSE",
"sshPublicKey": "{ssh-rsa public key}",
"version": "12 SP1"
},
"powerState": "started",
"provisioningState": "Succeeded",
"proximityPlacementGroup": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup",
"storageProfile": {
"nfsIpAddress": "200.200.200.200"
}
},
"systemData": {
"createdAt": "2020-12-20T23:10:22.6828621Z",
"createdBy": "user@microsoft.com",
"createdByType": "User",
"lastModifiedAt": "2021-07-21T08:01:22.0000000Z",
"lastModifiedBy": "user@microsoft.com",
"lastModifiedByType": "User"
},
"tags": {
"testkey": "testvalue"
}
}
},
"201": {
"body": {
"name": "myBMIInstance",
"type": "Microsoft.BareMetalInfrastructure/bareMetalInstances",
"id": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myBMIInstance",
"location": "westus",
"properties": {
"azureBareMetalInstanceId": "23415635-4d7e-41dc-9598-8194f22c24e1",
"hardwareProfile": {
"azureBareMetalInstanceSize": "S72",
"hardwareType": "Cisco_UCS"
},
"hwRevision": "Rev 3",
"networkProfile": {
"circuitId": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit",
"networkInterfaces": [
{
"ipAddress": "100.100.100.100"
}
]
},
"osProfile": {
"computerName": "myComputerName",
"osType": "SUSE",
"sshPublicKey": "{ssh-rsa public key}",
"version": "12 SP1"
},
"powerState": "started",
"provisioningState": "Succeeded",
"proximityPlacementGroup": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup",
"storageProfile": {
"nfsIpAddress": "200.200.200.200"
}
},
"systemData": {
"createdAt": "2020-12-20T23:10:22.6828621Z",
"createdBy": "user@microsoft.com",
"createdByType": "User",
"lastModifiedAt": "2021-07-21T08:01:22.0000000Z",
"lastModifiedBy": "user@microsoft.com",
"lastModifiedByType": "User"
},
"tags": {
"testkey": "testvalue"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{

Check failure on line 1 in specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Delete.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Delete.json#L1

specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Delete.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/baremetalinfrastructure/BareMetalInfrastructure.Management/examples/2024-08-01-preview/AzureBareMetalInstances_Delete.json
"operationId": "AzureBareMetalInstances_Delete",
"parameters": {
"api-version": "2024-08-01-preview",
"azureBareMetalInstanceName": "myAzureBareMetalInstance",
"resourceGroupName": "myResourceGroup",
"subscriptionId": "f0f4887f-d13c-4943-a8ba-d7da28d2a3fd"
},
"title": "AzureBareMetalInstances_Delete",
"responses": {
"200": {},
"204": {}
}
}
Loading
Loading