-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move initial work over from private repo
- Loading branch information
1 parent
fb39d98
commit b97a3ce
Showing
25 changed files
with
1,775 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,6 +418,7 @@ bzip | |
cacerts | ||
cadl | ||
calculatebaseline | ||
camara | ||
canadacentral | ||
canadaeast | ||
canceldelete | ||
|
42 changes: 42 additions & 0 deletions
42
specification/programmableconnectivity/Azure.ProgrammableConnectivity/apis/common.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-autorest"; | ||
import "@azure-tools/typespec-azure-core"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
|
||
namespace Azure.ProgrammableConnectivity; | ||
|
||
alias ServiceTraits = NoRepeatableRequests & | ||
NoConditionalRequests & | ||
SupportsClientRequestId & | ||
RequestHeadersTrait<ApcGatewayIdHeader>; | ||
|
||
alias Operations = Azure.Core.ResourceOperations<ServiceTraits>; | ||
|
||
@doc("Enum to provide static action endpoint") | ||
enum CommonActionEnum { | ||
@doc("Static endpoint") | ||
action: "action", | ||
} | ||
|
||
@doc("Resource representing an Operator Network") | ||
@resource("network") | ||
model Network { | ||
@key | ||
@pattern("[a-z0-9-]+$") | ||
@doc("The ID of the network") | ||
@visibility("read") | ||
networkId: string; | ||
} | ||
|
||
@doc("Header to identify APC Gateway resource.") | ||
model ApcGatewayIdHeader { | ||
@doc("The identifier of the APC Gateway resource which should handle this request.") | ||
@header("apc-gateway-id") | ||
apcGatewayId: string; | ||
} |
88 changes: 88 additions & 0 deletions
88
specification/programmableconnectivity/Azure.ProgrammableConnectivity/apis/location.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import "./common.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
|
||
namespace Azure.ProgrammableConnectivity; | ||
|
||
/// Interfaces | ||
|
||
interface LocationInterface { | ||
verify is Operations.ResourceAction< | ||
LocationEndpoint, | ||
LocationVerifyRequest, | ||
LocationVerifyResponse | ||
>; | ||
} | ||
|
||
/// Endpoints | ||
|
||
@resource("Location") | ||
@doc("Static endpoint to access Location API") | ||
model LocationEndpoint { | ||
@key("action") | ||
@doc("Static endpoint") | ||
@visibility("read") | ||
action: CommonActionEnum; | ||
} | ||
|
||
/// Request models | ||
|
||
@doc("Request to verify Location") | ||
model LocationVerifyRequest { | ||
@doc("Network to query for this device") | ||
network: Network; | ||
|
||
@doc("Latitude of location to be verified") | ||
@minValue(-90) | ||
@maxValue(90) | ||
latitude: float32; | ||
|
||
@doc("Longitude of location to be verified") | ||
@minValue(-180) | ||
@maxValue(180) | ||
longitude: float32; | ||
|
||
@doc("Accuracy expected for location verification in kilometers") | ||
@minValue(2) | ||
@maxValue(100) | ||
accuracy: int32; | ||
|
||
@doc("Maximum age before a response is stale") | ||
@minValue(60) | ||
maxAge: int32; | ||
|
||
...LocationDevice; | ||
} | ||
|
||
/// Response models | ||
|
||
@doc("Response verifying location") | ||
model LocationVerifyResponse { | ||
@doc("True if the location is verified, False otherwise") | ||
verified: boolean; | ||
} | ||
|
||
/// Common models | ||
|
||
// TODO - implement maxProperties = 2 and minProperties = 2 | ||
@doc("Device information needed by CAMARA Location API") | ||
model LocationDevice { | ||
@doc("External identifier or network access identifier of the device") | ||
networkAccessIdentifier?: string; | ||
|
||
// TODO - is there a good way to commonise the phone number definition and still capture that it's sometimes required and sometimes optional? | ||
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'") | ||
@pattern("^\\+?[0-9]{5,15}$") | ||
phoneNumber?: string; | ||
|
||
@doc("IPv4 address and port of the device, in the form address:port") | ||
@pattern("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])(?:\\.(?:[01]?\\d\\d?|2[0-4]\\d|25[0-5])){3}(:\\d{1,4})?$") | ||
ipv4Address?: string; | ||
|
||
@doc("IPv6 address of the device") | ||
@pattern("^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\\/.+)?$") | ||
ipv6Address?: string; | ||
} |
42 changes: 42 additions & 0 deletions
42
specification/programmableconnectivity/Azure.ProgrammableConnectivity/apis/network.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import "./common.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
|
||
namespace Azure.ProgrammableConnectivity; | ||
|
||
/// Interfaces | ||
|
||
interface Networks { | ||
list is Operations.ResourceList<Network>; | ||
|
||
retrieve is Operations.ResourceAction< | ||
NetworkRetrieveEndpoint, | ||
NetworkDevice, | ||
Network | ||
>; | ||
} | ||
|
||
/// Endpoints | ||
|
||
@resource("Network") | ||
@doc("Static endpoint to access Network API") | ||
model NetworkRetrieveEndpoint { | ||
@key("action") | ||
@doc("Static endpoint") | ||
@visibility("read") | ||
action: CommonActionEnum; | ||
} | ||
|
||
/// Common models | ||
|
||
@doc("Represents a Device whose Network is searched for") | ||
model NetworkDevice { | ||
// TODO - is there a good way to commonise the phone number definition and still capture that it's sometimes required and sometimes optional? | ||
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'") | ||
@pattern("^\\+?[0-9]{5,15}$") | ||
phoneNumber: string; | ||
} |
88 changes: 88 additions & 0 deletions
88
specification/programmableconnectivity/Azure.ProgrammableConnectivity/apis/number.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import "./common.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
|
||
namespace Azure.ProgrammableConnectivity; | ||
|
||
/// Interfaces | ||
|
||
@doc(""" | ||
Number operations include Frontend Authentication. | ||
This means that each operation has 2 responses. | ||
The first response is a 302 redirect, which redirects the device to the device's Network | ||
to authenticate directly. The Network responds with another 302 redirect and a token. | ||
This redirects the device to APC, where the token is used to verify / retrieve | ||
the device number. The second response is a 200 containing the result of the query. | ||
This flow takes place automatically without user interaction, and so only the result | ||
of the entire flow (the 200 response) is included in this document. | ||
""") | ||
interface NumberInterface { | ||
verify is Operations.ResourceAction< | ||
NumberEndpoint, | ||
NumberVerifyRequest, | ||
NumberVerifyResponse | ||
>; | ||
|
||
retrieve is Operations.ResourceAction< | ||
NumberEndpoint, | ||
{}, | ||
NumberRetrieveResponse | ||
>; | ||
} | ||
|
||
/// Endpoints | ||
|
||
@resource("Number") | ||
@doc("Static endpoint to access Number API") | ||
model NumberEndpoint { | ||
@key("action") | ||
@doc("Static endpoint") | ||
@visibility("read") | ||
action: CommonActionEnum; | ||
} | ||
|
||
/// Request models | ||
|
||
@doc("Request to verify number of device") | ||
model NumberVerifyRequest { | ||
@doc("Network to query for this device") | ||
network: Network; | ||
|
||
...NumberDevice; | ||
} | ||
|
||
/// Response models | ||
|
||
@doc("Response verifying number of device") | ||
model NumberVerifyResponse { | ||
@doc("True if number is verified, False otherwise") | ||
verified: boolean; | ||
} | ||
|
||
@doc("Response with number of device") | ||
model NumberRetrieveResponse { | ||
// TODO - is there a good way to commonise the phone number definition and still capture that it's sometimes required and sometimes optional? | ||
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'") | ||
@pattern("^\\+?[0-9]{5,15}$") | ||
phoneNumber: string; | ||
} | ||
|
||
/// Common models | ||
|
||
// TODO - implement maxProperties = 1 and minProperties = 1 | ||
@doc("Device information needed by CAMARA Number API") | ||
model NumberDevice { | ||
// TODO - is there a good way to commonise the phone number definition and still capture that it's sometimes required and sometimes optional? | ||
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'") | ||
@pattern("^\\+?[0-9]{5,15}$") | ||
phoneNumber?: string; | ||
|
||
@doc("Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile phone number in **E.164 format (starting with country code)**. Optionally prefixed with '+'.") | ||
hashedPhoneNumber?: string; | ||
} |
81 changes: 81 additions & 0 deletions
81
specification/programmableconnectivity/Azure.ProgrammableConnectivity/apis/simswap.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import "./common.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
|
||
namespace Azure.ProgrammableConnectivity; | ||
|
||
/// Interfaces | ||
|
||
interface SimSwapInterface { | ||
retrieve is Operations.ResourceAction< | ||
SimSwapEndpoint, | ||
SimSwapRetrieveRequest, | ||
SimSwapRetrieveResponse | ||
>; | ||
|
||
verify is Operations.ResourceAction< | ||
SimSwapEndpoint, | ||
SimSwapVerifyRequest, | ||
SimSwapVerifyResponse | ||
>; | ||
} | ||
|
||
/// Endpoints | ||
|
||
@resource("SimSwap") | ||
@doc("Static endpoint to access SimSwap API") | ||
model SimSwapEndpoint { | ||
@key("action") | ||
@doc("Static endpoint") | ||
@visibility("read") | ||
action: CommonActionEnum; | ||
} | ||
|
||
/// Request models | ||
|
||
@doc("Request to retrieve SimSwap date") | ||
model SimSwapRetrieveRequest { | ||
@doc("Network to query for this device") | ||
network: Network; | ||
|
||
...SimSwapDevice; | ||
} | ||
|
||
@doc("Request to verify SimSwap in period") | ||
model SimSwapVerifyRequest { | ||
@doc("Maximum lookback for SimSwap verification") | ||
maxAge?: int32; | ||
|
||
@doc("Network to query for this device") | ||
network: Network; | ||
|
||
...SimSwapDevice; | ||
} | ||
|
||
/// Response Models | ||
|
||
@doc("Response with SimSwap date") | ||
model SimSwapRetrieveResponse { | ||
@doc("Datetime of most recent swap for SIM") | ||
date: utcDateTime; | ||
} | ||
|
||
@doc("Response verifying SimSwap in period") | ||
model SimSwapVerifyResponse { | ||
@doc("True if the SIM has swapped in the specified period, False otherwise") | ||
verified: boolean; | ||
} | ||
|
||
/// Common models | ||
|
||
@doc("Device information needed by CAMARA SimSwap API") | ||
model SimSwapDevice { | ||
// TODO - is there a good way to commonise the phone number definition and still capture that it's sometimes required and sometimes optional? | ||
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'") | ||
@pattern("^\\+?[0-9]{5,15}$") | ||
phoneNumber: string; | ||
} |
5 changes: 5 additions & 0 deletions
5
specification/programmableconnectivity/Azure.ProgrammableConnectivity/client.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* PLACEHOLDER | ||
* Add readme and sample | ||
*/ | ||
import "./main.tsp"; |
28 changes: 28 additions & 0 deletions
28
...vity/Azure.ProgrammableConnectivity/examples/LocationInterface_Verify_MaximumSet_Gen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"title": "LocationInterface_Verify - generated by [MaximumSet] rule - generated by [MaximumSet] rule", | ||
"operationId": "LocationInterface_Verify", | ||
"parameters": { | ||
"api-version": "2023-11-14-preview", | ||
"action": "action", | ||
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000", | ||
"apc-gateway-id": "zlnvwgnnhcbhlwnh", | ||
"body": { | ||
"network": {}, | ||
"latitude": -88, | ||
"longitude": -163, | ||
"accuracy": 93, | ||
"maxAge": 1195, | ||
"networkAccessIdentifier": "awbbthkgdgvxbzywz", | ||
"phoneNumber": "373736662145", | ||
"ipv4Address": "236.236.60.07:8000", | ||
"ipv6Address": "::/t(qq]" | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"verified": true | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.