Skip to content
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

Add Azure Programmable Connectivity dataplane APIs #26922

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4b582ab
Move initial work over from private repo
AndrewNivenMSFT Dec 1, 2023
d41cd1f
Add some more TODOs
AndrewNivenMSFT Dec 4, 2023
8f659cc
Fix location API - Remove MaxAge parameter
jamie-ford-microsoft Dec 1, 2023
2ef822a
Resolve TODOs
ellabrmicrosoft Dec 12, 2023
c87bf01
fix pipeline issues
ellabrmicrosoft Dec 13, 2023
3d4747b
markups
ellabrmicrosoft Dec 15, 2023
98ca918
markups
ellabrmicrosoft Dec 15, 2023
5af7c18
markups
ellabrmicrosoft Dec 18, 2023
607df39
make extenrla id also consistant with strucutre
ellabrmicrosoft Dec 18, 2023
5a75550
fix formatting
ellabrmicrosoft Dec 18, 2023
4c6094b
Add Device to SimSwapVerifyRequest, and make IP addresses optional in…
AndrewNivenMSFT Dec 29, 2023
541edeb
change the scope URL to https://management.azure.com/.default
aronhegedusmicrosoftp Jan 2, 2024
de4e061
change scopein openapi.json to https://management.azure.com/.default …
aronhegedusmicrosoftp Jan 2, 2024
892b9ac
Adding python config to tspconfig.yaml
aronhegedusmicrosoftp Jan 2, 2024
8a5443d
change endpoint casing and fix formatting
ellabrmicrosoft Jan 5, 2024
aaeff63
update examples
ellabrmicrosoft Jan 5, 2024
90ddaf8
fix typo
ellabrmicrosoft Jan 9, 2024
1ea6e6a
add c sharp
aronhegedusmicrosoftp Jan 8, 2024
cb545a8
rename some variables because .net generatiopn is complaining about i…
aronhegedusmicrosoftp Jan 8, 2024
15c9b15
some more replaces
aronhegedusmicrosoftp Jan 8, 2024
fc6a5a2
Fix single word classes:
aronhegedusmicrosoftp Jan 8, 2024
66a2bca
try adding veriosning
aronhegedusmicrosoftp Jan 8, 2024
948e237
try adding ver
aronhegedusmicrosoftp Jan 8, 2024
e911aa7
fix date
aronhegedusmicrosoftp Jan 9, 2024
c8c85ee
replace NetworkDevice >>> NetworkRetrieveResult
aronhegedusmicrosoftp Jan 9, 2024
4ad9e06
Typespec validation pass
AndrewNivenMSFT Jan 9, 2024
13e7905
replace older version with current one
aronhegedusmicrosoftp Jan 9, 2024
16b9baa
Further pipeline fixing
AndrewNivenMSFT Jan 9, 2024
ec4b57f
use proper nouns, and do easy changes
aronhegedusmicrosoftp Jan 10, 2024
e78e2f4
camel case
aronhegedusmicrosoftp Jan 11, 2024
5cb65b9
replace *Interface with base path of the API
aronhegedusmicrosoftp Jan 11, 2024
28d5eb4
Retrieve>Retrieval
aronhegedusmicrosoftp Jan 11, 2024
55463a9
blankline
aronhegedusmicrosoftp Jan 11, 2024
508daab
rename some variables
aronhegedusmicrosoftp Jan 11, 2024
e5a0e16
new lines prettier
aronhegedusmicrosoftp Jan 11, 2024
a18e3ab
number interface > number verification
aronhegedusmicrosoftp Jan 11, 2024
eeafac0
new lines
aronhegedusmicrosoftp Jan 11, 2024
aebef24
blank lines
aronhegedusmicrosoftp Jan 11, 2024
7aa65ef
Add deprecation notice
AndrewNivenMSFT Feb 2, 2024
9098b0e
remove enums and add response header
aronhegedusmicrosoftp Feb 5, 2024
fa78fb9
remove devicenetworkidentifier, as it's duplicate, change long/latitu…
aronhegedusmicrosoftp Feb 6, 2024
4b0f930
Make ApcError an extension of Azure.Core.Foundations.Error
AndrewNivenMSFT Feb 6, 2024
14680a3
Number verification updates for frontend auth
jamie-ford-microsoft Feb 7, 2024
8942871
ImplDocument number verification in typespec
AndrewNivenMSFT Feb 8, 2024
21dcd98
Remove python and .net sdk configuration, pending resolution of names…
AndrewNivenMSFT Feb 8, 2024
c3e8178
Update date of api version
AndrewNivenMSFT Feb 8, 2024
873d9ac
Some pipeline wrangling
AndrewNivenMSFT Feb 8, 2024
2d443e4
Remove NumberVerification retrieval APIs as they will not be implemen…
AndrewNivenMSFT Feb 9, 2024
e00bba5
Add back Python SDK after fixes to autogen
AndrewNivenMSFT Feb 10, 2024
87cd804
Improve docstrings, try to localize suppressions
AndrewNivenMSFT Feb 13, 2024
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
2 changes: 2 additions & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ aods
aosm
apac
apacheavro
apcgatewayapi
api's
apim
apimanagement
Expand Down Expand Up @@ -422,6 +423,7 @@ bzip
cacerts
cadl
calculatebaseline
camara
canadacentral
canadaeast
canceldelete
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import "@typespec/rest";
import "@typespec/versioning";
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> &
// Note that ResponseHeadersTrait is overridden in number operations
// If you modify this, you must also modify it in the number operations.
ResponseHeadersTrait<RequestIdResponseHeader>;

// alias Operations = Azure.Core.ResourceOperations<ServiceTraits, ApcErrorResponse>;
alias Operations = Azure.Core.ResourceOperations<
ServiceTraits,
Azure.Core.Foundations.ErrorResponse
>;

@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;
}

@doc("Identifier for the network to be queried")
model NetworkIdentifier {
@doc("The type of identifier for the network. one of: 'IPv4', 'IPv6', 'NetworkCode'")
identifierType: string;

@doc("""
The network identifier, based on the identifierType: an IPv4 address, and IPv6 address, or a Network Code.
A Network Code may be obtained from APC documentation or from the APC /Network:retrieve endpoint.
""")
identifier: string;
AndrewNivenMSFT marked this conversation as resolved.
Show resolved Hide resolved
}

@doc("The phone number of the device.")
model PhoneNumberModel {
AndrewNivenMSFT marked this conversation as resolved.
Show resolved Hide resolved
@doc("Phone number in E.164 format (starting with country code), and optionally prefixed with '+'")
@pattern("^\\+?[0-9]{5,15}$")
phoneNumber?: string;
}

@doc("The network access ID/external ID of the device")
model NetworkAccessIdentifierModel {
@doc("External identifier or network access identifier of the device")
networkAccessIdentifier?: string;
}

@error
@doc("A custom error response for APC.")
model ApcErrorResponse {
@doc("Error returned by APC")
error: ApcError;

@header("x-ms-error-code")
@doc("String error code indicating what went wrong.")
errorCode?: string;
}

@doc("A custom error for APC.")
model ApcError {
...Azure.Core.Foundations.Error;

@doc("The consent URL in case of a consent failure")
consentUrl?: url;
}

@doc("IPv4 address and port of the device")
model Ipv4AddressModel {
@doc("The Ipv4 address")
ipv4Address?: Ipv4Address;
}

@doc("IPv4 address and port of the device")
model Ipv6AddressModel {
@doc("The Ipv6 address")
ipv6Address?: Ipv6Address;
}

@doc("IPv4 device indicator")
model Ipv4Address {
@doc("An IPv4 address. This may be specified as an exact address, or as a subnet in CIDR notation.")
ipv4: string;

@doc("User equipment port.")
port: int32;
}

@doc("IPv6 device indicator")
model Ipv6Address {
@doc("An IPv6 address. This may be specified as an exact address, or as a subnet in CIDR notation.")
ipv6: string;
AndrewNivenMSFT marked this conversation as resolved.
Show resolved Hide resolved

@doc("User equipment port.")
port: int32;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import "./common.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;

namespace Azure.ProgrammableConnectivity;

/// Interfaces

interface DeviceLocation {
@doc("Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude.")
verify is Operations.ResourceAction<
DeviceLocationEndpoint,
DeviceLocationVerificationContent,
DeviceLocationVerificationResult
>;
}

/// Endpoints

@resource("device-location")
@doc("Static endpoint to access the Device Location API family.")
model DeviceLocationEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
location: "location";
}

/// Request models

@doc("Request to verify Location")
model DeviceLocationVerificationContent {
@doc("Network to query for this device, or device information to enable network routing.")
networkIdentifier: NetworkIdentifier;

@doc("Latitude of location to be verified")
@minValue(-90)
@maxValue(90)
latitude: float64;

@doc("Longitude of location to be verified")
@minValue(-180)
@maxValue(180)
longitude: float64;

@doc("Accuracy expected for location verification in kilometers")
@minValue(2)
@maxValue(100)
accuracy: int32;

@doc("The device to find the location for. Exactly one of Network Access Code, Phone Number, IPv4 address, or IPv6 address")
device: LocationDevice;
}

/// Response models

@doc("Response verifying location")
model DeviceLocationVerificationResult {
@doc("True if the location is in the specified area, False otherwise")
verificationResult: boolean;
}

/// Common models

// LocationDevice represents a Device as required by the Location API. The APC team aims
// to drive commonisation of the underlying CAMARA APIs so that all APIs can share a common Device
// model in future.
@doc("Device information needed by operator to provide location information. Include exactly one of these properties to identify your device.")
model LocationDevice {
...NetworkAccessIdentifierModel;
DominikMe marked this conversation as resolved.
Show resolved Hide resolved
...PhoneNumberModel;
...Ipv4AddressModel;
...Ipv6AddressModel;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "./common.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;

namespace Azure.ProgrammableConnectivity;

/// Interfaces

interface DeviceNetwork {
@doc("Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs.")
retrieve is Operations.ResourceAction<
AndrewNivenMSFT marked this conversation as resolved.
Show resolved Hide resolved
DeviceNetworkRetrievalEndpoint,
NetworkIdentifier,
NetworkRetrievalResult
>;
}

/// Endpoints

@resource("device-network")
@doc("Static endpoint to access the Device Network API family.")
model DeviceNetworkRetrievalEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
network: "network";
}

/// Common models

@doc("The network that the device is on.")
model NetworkRetrievalResult {
@pattern("[a-z0-9-]+$")
@doc("The identifier for the network. This can be used as the networkIdentifier for the service APIs.")
networkCode: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import "./common.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;

namespace Azure.ProgrammableConnectivity;

/// Interfaces

@doc("""
Number operations include Frontend Authentication.
Users first make a call to the endpoint /Number:verify, which returns a redirect to the device's
Network. This is followed by the device to authenticate directly with the Network. The Network
responds with a token and a redirect. This token can be exchanged with APC for a code.
Users make a second call to the endpoint /Number:verify including the code. The code is used
to verify the device number. The second response is a 200 containing the result of the query.
For more information on the steps required to use Number Verificaiton, see the APC documentation.
""")
interface NumberVerification {
#suppress "@azure-tools/typespec-azure-core/no-response-body" "302 redirect has no response body"
@doc("Verifies the phone number (MSISDN) associated with a device. As part of the frontend authorization flow, the device is redirected to the operator network to authenticate directly.")
@sharedRoute
@action("verify")
verifyWithoutCode is Operations.ResourceAction<
NumberVerificationEndpoint,
NumberVerificationWithoutCodeContent,
TypeSpec.Http.Response<302> & {},
TraitOverride<ResponseHeadersTrait<{
@header location: string;
} & RequestIdResponseHeader>>
>;

@doc("Verifies the phone number (MSISDN) associated with a device.")
@sharedRoute
@action("verify")
verifyWithCode is Operations.ResourceAction<
NumberVerificationEndpoint,
NumberVerificationWithCodeContent,
NumberVerificationResult
>;
}

/// Endpoints

@resource("number-verification")
@doc("Static endpoint to access Number Verification API family")
model NumberVerificationEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
number: "number";
}

/// Request models

@doc("Request to verify number of device - first call")
model NumberVerificationWithoutCodeContent {
@doc("Identifier for the network to query for this device.")
networkIdentifier: NetworkIdentifier;

...NumberDevice;
}

@doc("Request to verify number of device - second call")
model NumberVerificationWithCodeContent {
@doc("Identifier for the network to query for this device.")
networkIdentifier: NetworkIdentifier;

...NumberDevice;

@doc("The code provided by APC in exchange for the operator code.")
apcCode: string;
}

/// Response models

@doc("Response verifying number of device")
model NumberVerificationResult {
@doc("True if number if the phone number matches the device, False otherwise")
verificationResult: boolean;
}

/// Common models

// NumberDevice represents a Device as required by the Number Verification API. The APC team aims
// to drive commonisation of the underlying CAMARA APIs so that all APIs can share a common Device
// model in future.
@doc("Device information to verify phone number. Include exactly one form of phone number.")
model NumberDevice {
...PhoneNumberModel;

@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;
AndrewNivenMSFT marked this conversation as resolved.
Show resolved Hide resolved
}
Loading