-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JMayrbaeurl/registryadd
Add Registry service implementation
- Loading branch information
Showing
43 changed files
with
5,859 additions
and
84 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,11 @@ | ||
[ | ||
{ | ||
"allowedMemberTypes": [ | ||
"Application" | ||
], | ||
"description": "Contributors have to right to read and write AAS objects", | ||
"displayName": "AAS Contributor", | ||
"isEnabled": true, | ||
"value": "AAS.ReadWrite" | ||
} | ||
] |
22 changes: 22 additions & 0 deletions
22
scripts/azuredeployment/createAzureDigitalTwinsInstance.ps1
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,22 @@ | ||
# Create Azure Digital Twin instance for the Shell and Discovery service | ||
# uses the currently selected Azure subscription. Azure CLI version 2.14.0 or higher. | ||
|
||
param ( | ||
[string] $dcloc = "West Europe", | ||
[string] $rg = "aas-sample-rg", | ||
[string] $dtName = "aasrepositorydigitaltwins" | ||
) | ||
|
||
# 1. Check existenc of resource group and create it if it's not existing yet | ||
$rsgExists = az group exists -n $rg | ||
if ( $rsgExists -eq 'false') { | ||
Write-Host "Resource group " $rg " doesn't exist. Creating it now." | ||
az group create -l $dcloc -n $rg | ||
} | ||
|
||
# 2. Create Azure Digital Twin instance | ||
az dt create --dt-name $dtName -g $rg -l $dcloc --assign-identity true | ||
|
||
# 3. Create ADT Data Owner role for current user | ||
$currAcc = $(az account show) | ConvertFrom-Json | ||
az dt role-assignment create --dt-name $dtName -g $rg --assignee $currAcc.user.name --role "Azure Digital Twins Data Owner" |
40 changes: 40 additions & 0 deletions
40
scripts/azuredeployment/createAzureRedisCacheDBForRegistryServer.ps1
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,40 @@ | ||
# Create Azure Redis Cache DB for the AAS Registry service | ||
# uses the currently selected Azure subscription. Azure CLI version 2.14.0 or higher. | ||
# Will create an Azure Redis Cache DB (Basic C0). | ||
# If parameter 'appName' contains a valid Web App name in the same resource group, it will | ||
# automatically set the Web Apps config para 'AASREGISTRYCACHECONNSTRING' to the connection | ||
# string of the created Redis Cache DB. | ||
|
||
param ( | ||
[string] $dcloc = "West Europe", | ||
[string] $rg = "aas-sample-rg", | ||
[string] $cacheName = "aasregistrycache", | ||
[string] $cacheSku = "Basic", | ||
[string] $cacheVmSize = "c0", | ||
[string] $appName | ||
) | ||
|
||
# 1. Check existenc of resource group and create it if it's not existing yet | ||
$rsgExists = az group exists -n $rg | ||
if ( $rsgExists -eq 'false') { | ||
Write-Host "Resource group " $rg " doesn't exist. Creating it now." | ||
az group create -l $dcloc -n $rg | ||
} | ||
|
||
# 2. Create Redis Cache if it doesn't exist yet | ||
$existingCaches=$(az redis list --query "[?name=='$cacheName']") | ||
if ( $$existingCaches.length == 0) { | ||
Write-Host "Redis cache with name " $cacheName " doesn't exist. Creating it now" | ||
|
||
$redis=$(az redis create --location $dcloc --name $cacheName -g $rg ` | ||
--sku $cacheSku --vm-size $cacheVmSize --redis-version 6 --query [hostName,sslPort] --output tsv) | ||
|
||
# 3. Get connection string | ||
$key=$(az redis list-keys --name $cacheName -g $rg --query primaryKey --output tsv) | ||
$connString=$redis[0] + ":" + $redis[1] + ",password=" + $key + ",ssl=True,abortConnect=False" | ||
Write-Host "Redis cache connection string: " $connString | ||
|
||
# 4. Assign the connection string to an App Setting in the Web App | ||
if (-not $appName) | ||
az webapp config appsettings set --name $appName -g $rg --settings "AASREGISTRYCACHECONNSTRING=$connString" | ||
} |
41 changes: 41 additions & 0 deletions
41
scripts/azuredeployment/createAzureStorageForAASXFileServer.ps1
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,41 @@ | ||
# Create Azure storage account for an AASX File Server | ||
# uses the currently selected Azure subscription. Azure CLI version 2.14.0 or higher. | ||
# Will create an ADLS storage account with hierarchical namespaces | ||
|
||
param ( | ||
[string] $dcloc = "West Europe", | ||
[string] $rg = "aas-sample-rg", | ||
[string] $storageAccName = "aasxfileserverstorage", | ||
[string] $storageSku = "Standard_LRS" | ||
) | ||
|
||
# 1. Check existenc of resource group and create it if it's not existing yet | ||
$rsgExists = az group exists -n $rg | ||
if ( $rsgExists -eq 'false') { | ||
Write-Host "Resource group " $rg " doesn't exist. Creating it now." | ||
az group create -l $dcloc -n $rg | ||
} | ||
|
||
# 2. Create Azure storage account if not exists yet | ||
$storageAccExists = $(az storage account check-name --name $storageAccName) | ConvertFrom-Json | ||
if ( $storageAccExists.nameAvailable ) { | ||
Write-Host "Storage account " $storageAccName " doesn't exist. Creating it now." | ||
az storage account create -n $storageAccName -g $rg -l $dcloc --access-tier Hot --sku $storageSku --kind "StorageV2" ` | ||
--allow-blob-public-access false --allow-shared-key-access false --enable-hierarchical-namespace true | ||
} | ||
|
||
# 3. Create container for AASX file packages | ||
$contExists = $(az storage container exists --name aasxfiles --account-name $storageAccName --auth-mode login) | ConvertFrom-Json | ||
if (-not($contExists.exists) ) { | ||
Write-Host "Container for AASX packages doesn't exist. Creating it now." | ||
az storage container create --name aasxfiles --account-name $storageAccName --auth-mode login | ||
} | ||
|
||
# 4. Assign roles to creating user | ||
$currAcc = $(az account show) | ConvertFrom-Json | ||
$storageAccId = $(az storage account show -n $storageAccName -g $rg --query id) | ||
az role assignment create --role "Storage Blob Data Owner" --assignee $currAcc.user.name --scope $storageAccId | ||
|
||
# 5. Set correct access | ||
# $oldContAcc = $(az storage fs access show --account-name $storageAccName --file-system aasxfiles --path . --auth-mode login) | ||
az storage fs access set --acl "user::rwx,group::r-x,other::r-x" --path . -f aasxfiles --account-name $storageAccName --auth-mode login |
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,34 @@ | ||
# Create Azure Web Api app for AAS Services | ||
# uses the currently selected Azure subscription. Azure CLI version 2.14.0 or higher. | ||
|
||
param ( | ||
[string] $dcloc = "West Europe", | ||
[string] $rg = "aas-sample-rg", | ||
[string] $planName = "aasappserviceplan", | ||
[string] $planSku = "B1", | ||
[string] $appName = "aasapiservice" | ||
) | ||
|
||
# 1. Check existenc of resource group and create it if it's not existing yet | ||
$rsgExists = az group exists -n $rg | ||
if ( $rsgExists -eq 'false') { | ||
Write-Host "Resource group " $rg " doesn't exist. Creating it now." | ||
az group create -l $dcloc -n $rg | ||
} | ||
|
||
# 2. Create App service plan if it doesn't exist yet | ||
$existingPlan=$(az appservice plan list -g $rg --query "[?name=='$planName']") | ||
if ($existingPlan.length == 0) { | ||
az appservice plan create --name $planName --g $rg --location $dcloc --is-linux --sku $planSku | ||
} | ||
|
||
# 3. Create Web app | ||
az webapp create -g $rg -p $planName -n $appName --runtime "DOTNETCORE|3.1" --assign-identity | ||
|
||
# TODO Set 'kind' to "linux,api" with 'az resource update' to enable API features in portal | ||
|
||
# 4. Create App registration for Web app | ||
$clientId = $(az ad app create --display-name $appName --available-to-other-tenants false --app-roles @aasapiservicestdroles.json --query appId -o tsv) | ||
|
||
# 5. Set Azure AD configurtion in Web app | ||
az webapp config appsettings set --name $appName -g $rg --settings "AzureAd__ClientId=$clientId" |
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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
using System; | ||
using AAS.API.Models; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AAS.API.Interfaces | ||
{ | ||
public interface Registry | ||
{ | ||
public Task<List<AssetAdministrationShellDescriptor>> GetAllAssetAdministrationShellDescriptors(); | ||
|
||
public Task<AssetAdministrationShellDescriptor> GetAssetAdministrationShellDescriptorById(string aasIdentifier); | ||
|
||
public Task<AssetAdministrationShellDescriptor> CreateAssetAdministrationShellDescriptor(AssetAdministrationShellDescriptor aasDesc); | ||
|
||
public Task UpdateAssetAdministrationShellDescriptorById(AssetAdministrationShellDescriptor aasDesc, string aasIdentifier); | ||
|
||
public Task DeleteAssetAdministrationShellDescriptorById(string aasIdentifier); | ||
} | ||
} |
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,19 @@ | ||
using AAS.API.Models; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace AAS.API.Interfaces | ||
{ | ||
public interface SubmodelRegistry | ||
{ | ||
public Task<List<SubmodelDescriptor>> GetAllSubmodelDescriptors(); | ||
|
||
public Task<SubmodelDescriptor> GetSubmodelDescriptorById(string submodelIdentifier); | ||
|
||
public Task<SubmodelDescriptor> CreateSubmodelDescriptor(SubmodelDescriptor submodelDescriptor); | ||
|
||
public Task UpdateSubmodelDescriptorById(string submodelIdentifier, SubmodelDescriptor submodelDescriptor); | ||
|
||
public Task DeleteSubmodelDescriptorById(string idsubmodelIdentifier); | ||
} | ||
} |
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
Oops, something went wrong.