Skip to content

Commit

Permalink
Mobile packet core service
Browse files Browse the repository at this point in the history
  • Loading branch information
mgl1969 committed Jan 24, 2024
1 parent c75671a commit 4168492
Show file tree
Hide file tree
Showing 103 changed files with 8,013 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

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

namespace Microsoft.MobilePacketCore;

@doc("Azure for Operators 5G Core Access and Mobility Function (AMF) Deployment Resource")
@resource("amfDeployments")
model AmfDeploymentResource
is TrackedResource<AmfDeploymentResourceProperties> {
@doc("The name of the AMF Deployment")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$")
@minLength(1)
@maxLength(63)
@key("amfDeploymentName")
@path
@segment("amfDeployments")
@visibility("create", "read")
name: string;
}

@doc("AMF Deployment Properties.")
model AmfDeploymentResourceProperties {
@doc("The status of the last operation.")
@visibility("read")
provisioningState?: ProvisioningState;

@doc("Azure for Operators 5G Core AMF component parameters")
componentParameters?: ComponentDeploymentParameters;

@doc("Azure for Operators 5G Core AMF secrets parameters")
@secret
secretsParameters?: ComponentDeploymentSecrets;

@doc("Reference to cluster where the Network Function is deployed")
@visibility("create", "read")
clusterService: ClusterServiceIdProperty;

@doc("Release version. This is inherited from the cluster")
@visibility("read")
releaseVersion?: ReleaseVersion;

@doc("Operational status")
@visibility("read")
operationalStatus?: OperationalStatus;
}

@armResourceOperations(AmfDeploymentResource)
interface AmfDeployments {
get is ArmResourceRead<AmfDeploymentResource>;
createOrUpdate is ArmResourceCreateOrUpdate2Async<AmfDeploymentResource>;
updateTags is ArmTagsPatchSync<AmfDeploymentResource>;
delete is ArmResourceDeleteWithoutOkAsync<AmfDeploymentResource>;
listByResourceGroup is ArmResourceListByParent<AmfDeploymentResource>;
listBySubscription is ArmListBySubscription<AmfDeploymentResource>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

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

namespace Microsoft.MobilePacketCore;

@doc("Azure for Operators 5G Core Cluster Service Resource")
@resource("clusterServices")
model ClusterServiceResource
is TrackedResource<ClusterServiceResourceProperties> {
@doc("The name of the Cluster Service")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$")
@minLength(1)
@maxLength(63)
@key("clusterServiceName")
@path
@segment("clusterServices")
@visibility("create", "read")
name: string;
}

@doc("Cluster Service Properties.")
model ClusterServiceResourceProperties {
@doc("The status of the last operation.")
@visibility("read")
provisioningState?: ProvisioningState;

@doc("Cluster type (Lab or Production)")
@visibility("create", "read")
deploymentType: SkuDeploymentType;

@doc("Azure for Operators 5G Core Release Version. This is applied to all platform as a service (PaaS) components and running workloads in this cluster")
releaseVersion: ReleaseVersion;

@doc("Cluster type specific data. Contents depend on the cluster type")
clusterTypeSpecificData: ClusterServiceClusterTypeSpecificData;

@doc("Azure for Operators 5G Core Local PaaS component parameters. One set per component type")
@extension("x-ms-identifiers", ["type"])
componentParameters: QualifiedComponentDeploymentParameters[];

@doc("Operational status")
@visibility("read")
operationalStatus?: OperationalStatus;
}

@armResourceOperations(ClusterServiceResource)
interface ClusterServices {
get is ArmResourceRead<ClusterServiceResource>;
createOrUpdate is ArmResourceCreateOrUpdate2Async<ClusterServiceResource>;
updateTags is ArmTagsPatchSync<ClusterServiceResource>;
delete is ArmResourceDeleteWithoutOkAsync<ClusterServiceResource>;
listByResourceGroup is ArmResourceListByParent<ClusterServiceResource>;
listBySubscription is ArmListBySubscription<ClusterServiceResource>;
}

@doc("Cluster Service cluster type specific data.")
@discriminator("type")
model ClusterServiceClusterTypeSpecificData {
@doc("Cluster Type")
type: ClusterType;

@doc("Custom Location resource ID")
customLocationId: CustomLocationIdProperty;
}

@doc("AKS Cluster specific data.")
model ClusterServiceAksClusterData
extends ClusterServiceClusterTypeSpecificData {
@doc("Azure Kubernetes Service Properties.")
type: ClusterType.Aks;
}

@doc("Nexus AKS Cluster specific data.")
model ClusterServiceNexusAksClusterData
extends ClusterServiceClusterTypeSpecificData {
@doc("Nexus Operator Kubenetes Service Properties.")
type: ClusterType.NexusAks;
}
172 changes: 172 additions & 0 deletions specification/mobilepacketcore/MobilePacketCore.Management/common.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

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

namespace Microsoft.MobilePacketCore;

/** Compliant create or update template */
/**
* A long-running resource CreateOrUpdate (PUT)
* @template TResource the resource being patched
* @template TBaseParameters Optional. Allows overriding the operation parameters
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "This is a valid template"
@autoRoute
@doc("Create a {name}", TResource)
@OpenAPI.extension("x-ms-long-running-operation", true)
@OpenAPI.extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
@armResourceCreateOrUpdate(TResource)
@put
op ArmResourceCreateOrUpdate2Async<
TResource extends Azure.ResourceManager.Foundations.ArmResource,
TBaseParameters = Azure.ResourceManager.Foundations.BaseParameters<TResource>
>(
...ResourceInstanceParameters<TResource, TBaseParameters>,

@doc("Resource create parameters.")
@body
resource: TResource,
): ArmUpdatedResponse<TResource> | ArmCreatedResponse<TResource> | ErrorResponse;

@doc("ARM resource update successful")
model ArmUpdatedResponse<TResource extends Azure.ResourceManager.Foundations.ArmResource>
is ArmResponse<TResource>;

@doc("Provisioning state of the resource")
@Azure.Core.lroStatus
enum ProvisioningState {
...ResourceProvisioningState,

@doc("Resource is getting provisioned")
Provisioning,

@doc("Resource is updating")
Updating,

@doc("Resource is getting deleted")
Deleting,

@doc("Resource has been accepted")
Accepted,
}

@doc("ARM resource ID of a cluster.")
scalar ClusterServiceIdProperty
extends Azure.ResourceManager.ResourceIdentifier<[
{
type: "Microsoft.MobilePacketCore/clusterServices",
}
]>;

@doc("ARM resource ID of a VNF Agent deployment.")
scalar VnfAgentDeploymentIdProperty
extends Azure.ResourceManager.ResourceIdentifier<[
{
type: "Microsoft.MobilePacketCore/vnfAgentDeployments",
}
]>;

@doc("ARM resource ID of a custom location.")
scalar CustomLocationIdProperty
extends Azure.ResourceManager.ResourceIdentifier<[
{
type: "Microsoft.ExtendedLocation/customLocations",
}
]>;

@doc("Operational Status of the resource")
model OperationalStatus {
@doc("Status of the deployed workload")
@visibility("read")
workload?: string;

@doc("Health check results")
@visibility("read")
healthCheck?: string;
}

@doc("Infrastructure Type Definitions")
enum InfrastructureType {
@doc("Azure Core")
AzureCore,

@doc("Azure Operator Nexus")
AzureOperatorNexus,
}

@doc("Deployment Type Definitions")
enum SkuDeploymentType {
@doc("Production Deployment")
Production,

@doc("Lab Deployment")
Lab,
}

@doc("Cluster Type Definitions")
enum ClusterType {
@doc("Azure Kubernetes Service")
Aks,

@doc("Azure Operator Nexus Kubernetes Service")
NexusAks,
}

@doc("Usage SKU Definition")
scalar UsageSku extends string;

@doc("Mobile Core Scaling Unit SKU Definition")
scalar MobileCoreScalingUnitSku extends string;

@doc("Azure for Operators 5G Core Release Version.")
scalar ReleaseVersion extends string;

@doc("Containerized Network Function (CNF) Component Deployment Parameters")
scalar ComponentDeploymentParameters extends string;

@doc("Containerized Network Function (CNF) Component Secrets")
scalar ComponentDeploymentSecrets extends string;

@doc("Containerized Network Function (CNF) Component Deployment Type")
scalar ComponentDeploymentType extends string;

@doc("Containerized Network Function (CNF) Qualified Deployment Parameters")
model QualifiedComponentDeploymentParameters {
@doc("Federation Type")
type: ComponentDeploymentType;

@doc("Deployment Parameters")
parameters?: ComponentDeploymentParameters;

@doc("Deployment secrets")
@secret
secrets?: ComponentDeploymentSecrets;
}

@doc("ManagedResourceGroupConfiguration represents the configuration of the resource group managed by Azure.")
model ManagedResourceGroupConfiguration {
@doc("The name for the managed resource group. If not specified, the unique name is automatically generated.")
@visibility("create", "read")
@maxLength(75)
name?: string;

@doc("The location of the managed resource group. If not specified, the location of the parent resource is chosen.")
@visibility("create", "read")
location?: string;
}
Loading

0 comments on commit 4168492

Please sign in to comment.