diff --git a/.github/workflows/sandbox-sanity-test.yml b/.github/workflows/sandbox-sanity-test.yml index 3cc26fac..4f74f905 100644 --- a/.github/workflows/sandbox-sanity-test.yml +++ b/.github/workflows/sandbox-sanity-test.yml @@ -289,71 +289,15 @@ jobs: echo "=========================================" docker logs symphony-api-container --tail=100 2>&1 || echo "Could not retrieve Symphony logs" - - name: WFM-Client (K3s) – Setup + - name: WFM-Client (K3s) - Setup working-directory: scripts run: | sudo -E bash ./device-agent.sh k3s install sudo -E bash ./device-agent.sh k3s create-rsa-certs sudo -E bash ./device-agent.sh k3s create-ecdsa-certs - - name: Configure CoreDNS for k3s - run: | - RUNNER_IP=${RUNNER_IP} - echo "📡 Configuring CoreDNS with custom DNS entries..." - - # Retry logic for ConfigMap update - for RETRY in {1..3}; do - echo "Attempt $RETRY to configure CoreDNS..." - - # Get the full ConfigMap YAML - sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml \ - kubectl -n kube-system get configmap coredns -o yaml > config.yaml - - # Update the Corefile section - awk -v ip="$RUNNER_IP" ' - /NodeHosts: \|/ { - print - getline - print " " ip " harbor.machine" - print " " ip " symphony.machine" - print - next - } - { print } - ' config.yaml > config-new.yaml - - # Verify the change was made - if grep -q "harbor.machine" config-new.yaml && grep -q "symphony.machine" config-new.yaml; then - echo "✅ DNS entries added to ConfigMap" - - # Apply the updated ConfigMap - sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl apply -f config-new.yaml - - # Restart CoreDNS - sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl rollout restart deployment coredns -n kube-system - sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl rollout status deployment/coredns -n kube-system --timeout=60s - - # Wait longer for DNS propagation - echo "⏳ Waiting for DNS propagation..." - sleep 15 - - echo "✅ CoreDNS configured successfully" - break - else - echo "⚠️ DNS entries not found in updated ConfigMap, retrying..." - sleep 5 - fi - - if [ $RETRY -eq 3 ]; then - echo "❌ Failed to configure CoreDNS after 3 attempts" - echo "ConfigMap contents:" - cat config-new.yaml - exit 1 - fi - done - - - name: WFM-Client (Standalone Cluster) – Start + - name: WFM-Client (Helm-capable device) - Start working-directory: scripts run: | sudo -E bash ./device-agent.sh k3s start-k3s @@ -370,7 +314,7 @@ jobs: sleep 2 done - - name: WFM-Client (Standalone Device) – Start + - name: WFM-Client (Compose-capable device) - Start working-directory: scripts run: | sudo -E bash ./device-agent.sh docker create-rsa-certs @@ -441,7 +385,7 @@ jobs: ( echo "📋 Deploying to K3s..." PACKAGE_ID=$(sudo -E bash ./wfm-cli.sh get-package-id-by-name "${APP_PACKAGE_NAME_K3S}" | tail -n1) - DEVICE_ID=$(sudo -E bash ./wfm-cli.sh get-device-id-by-role "Standalone Cluster" | tail -n1) + DEVICE_ID=$(sudo -E bash ./wfm-cli.sh get-device-id-by-deployment-type "helm" | tail -n1) if [ -z "$PACKAGE_ID" ] || [ "$PACKAGE_ID" = "null" ] || [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" = "null" ]; then echo "❌ K3s: Invalid IDs" @@ -474,7 +418,7 @@ jobs: ( echo "📋 Deploying to Docker..." PACKAGE_ID=$(sudo -E bash ./wfm-cli.sh get-package-id-by-name "${APP_PACKAGE_NAME_DOCKER}" | tail -n1) - DEVICE_ID=$(sudo -E bash ./wfm-cli.sh get-device-id-by-role "Standalone Device" | tail -n1) + DEVICE_ID=$(sudo -E bash ./wfm-cli.sh get-device-id-by-deployment-type "compose" | tail -n1) if [ -z "$PACKAGE_ID" ] || [ "$PACKAGE_ID" = "null" ] || [ -z "$DEVICE_ID" ] || [ "$DEVICE_ID" = "null" ]; then echo "❌ Docker: Invalid IDs" diff --git a/.gitignore b/.gitignore index eb01ee94..e076d6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .buildx-cache/ +vendor \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS index 52d417b9..d821ecaa 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,14 +1,14 @@ # Default owners for everything -* @singhmj-1 @vireshnavalli +* @singhmj-1 @vireshnavalli @spulkit138 # Infra and scripts directory (CI/CD) -/scripts/ @nitparihar @sanjujunnuthula -/.github/ @nitparihar @sanjujunnuthula -/helmchart @nitparihar @sanjujunnuthula -/docker-compose @nitparihar @sanjujunnuthula +/scripts/ @nitparihar @sanjujunnuthula @rishabhrai9616 +/.github/ @nitparihar @sanjujunnuthula @rishabhrai9616 +/helmchart @nitparihar @sanjujunnuthula @rishabhrai9616 +/docker-compose @nitparihar @sanjujunnuthula @rishabhrai9616 # All testing directories -**/testing/ @nitparihar @sanjujunnuthula +**/testing/ @nitparihar @sanjujunnuthula @rishabhrai9616 # Root LICENSE file /LICENSE @ajcraig @phil-abb \ No newline at end of file diff --git a/docker-compose/config/config.yaml b/docker-compose/config/config.yaml index b23e935b..a677c438 100644 --- a/docker-compose/config/config.yaml +++ b/docker-compose/config/config.yaml @@ -1,6 +1,8 @@ logging: # Log level (e.g., DEBUG, INFO, WARN, ERROR, FATAL) level: DEBUG +database: + dataDir: "/var/lib/margo/device-agent/data" # directory where databse data is stored. # The device's root identity/attestation used for onboarding/registration of this device client with WFM (for auto-onboarding). deviceRootIdentity: diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 80612677..88a5c8d4 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -22,7 +22,7 @@ services: - ./config/device-ecdsa.key:/config/device-ecdsa.key - ./config/device-ecdsa.crt:/config/device-ecdsa.crt - ./config/ca-cert.pem:/config/ca-cert.pem - - ./data:/data + - ./data:/var/lib/margo/device-agent/data #should be changed to whatever is set as dataDir in config.yaml for device agent restart: unless-stopped entrypoint: ["./device-agent"] command: ["-config", "config/config.yaml"] diff --git a/docs/margo-architecture.png b/docs/margo-architecture.png index 7d427d8b..74387fde 100644 Binary files a/docs/margo-architecture.png and b/docs/margo-architecture.png differ diff --git a/docs/overlay-architecture.png b/docs/overlay-architecture.png index a3ba076b..65cc960c 100644 Binary files a/docs/overlay-architecture.png and b/docs/overlay-architecture.png differ diff --git a/docs/setup-guide.md b/docs/setup-guide.md index a240aff9..92e71029 100644 --- a/docs/setup-guide.md +++ b/docs/setup-guide.md @@ -7,8 +7,8 @@ | VM Type | Processors(vCPU) | Memory | Storage | Purpose | |---------|-----------|--------|---------|---------| | **Main VM (WFM)** | 8 | 16GB | 100GB | Workload Fleet Manager | -| **Device VM 1 (Standalone Cluster)** | 4 | 4-8GB | 50GB | Kubernetes-based device | -| **Device VM 2 (Standalone Device)** | 4 | 4-8GB | 50GB | Docker-based device | +| **Device VM 1 (Helm-capable device)** | 4 | 4-8GB | 50GB | Kubernetes-based device | +| **Device VM 2 (Compose-capable device)** | 4 | 4-8GB | 50GB | Docker-based device | **Requirements:** - Ubuntu operating system (**ubuntu-24.04.3-desktop-amd64 or server**) (you can check by doing ```cat /etc/os-release```) @@ -261,68 +261,21 @@ On each VM, you need to configure environment variables (settings that tell the cd $HOME/workspace/sandbox/scripts ``` -2. **Configure the domain/host(name) resolution in coredns** - - The k3s based setups don't pick the changes from `/etc/hosts` system file, hence it is better to add hostname details in the the coredns config itself. - - 2.1. Fetch the coredns config first: - ```bash - sudo kubectl -n kube-system edit configmap coredns - ``` - - 2.2. Then add only the highlighted lines in the `NodeHosts` section with your IP addresses in them and save: - ```yaml - apiVersion: v1 - data: - Corefile: | - .:53 { - errors - health - ready - kubernetes cluster.local in-addr.arpa ip6.arpa { - pods insecure - fallthrough in-addr.arpa ip6.arpa - } - hosts /etc/coredns/NodeHosts { - ttl 60 - reload 15s - fallthrough - } - prometheus :9153 - forward . /etc/resolv.conf - cache 30 - loop - reload - loadbalance - import /etc/coredns/custom/*.override - } - import /etc/coredns/custom/*.server - NodeHosts: | - 20.11.000.000 harbor.machine # Newly added line to resolve harbor.machine - 20.11.000.000 symphony.machine # Newly added line to resolve symphony.machine - 10.0.0.11 margo-wfm-v10 - ``` - - 2.3. Then apply the changes: - ```bash - sudo kubectl -n kube-system rollout restart deployment coredns - ``` - -3. **Start the device's Workload Fleet Management Client** +2. **Start the device's Workload Fleet Management Client** ```bash sudo -E bash device-agent.sh k3s ``` - Type `5` and press Enter - Choose: `Option 5: Device-agent-Start(k3s-device)` -4. **Check device status** +3. **Check device status** ```bash sudo -E bash device-agent.sh k3s ``` - Type `7` and press Enter - Choose: `Option 7: Device-agent-Status` -5. **View device logs** +4. **View device logs** ```bash # View the logs (replace with actual pod name from above using #7) sudo kubectl logs -f -n default diff --git a/go.mod b/go.mod index fe1a20be..10dda847 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,12 @@ require ( github.com/docker/compose/v2 v2.40.2 github.com/docker/docker v28.5.2+incompatible github.com/go-git/go-git/v5 v5.19.1 - github.com/go-playground/validator/v10 v10.14.1 + github.com/go-playground/validator/v10 v10.20.0 github.com/google/go-containerregistry v0.20.6 github.com/google/uuid v1.6.0 github.com/kr/pretty v0.3.1 github.com/lestrrat-go/htmsig v1.0.0 - github.com/oapi-codegen/runtime v1.1.1 + github.com/oapi-codegen/runtime v1.6.0 github.com/stretchr/testify v1.11.1 go.uber.org/zap v1.27.0 gopkg.in/yaml.v2 v2.4.0 @@ -93,9 +93,9 @@ require ( github.com/chai2010/gettext-go v1.0.2 // indirect github.com/cloudflare/circl v1.6.3 // indirect github.com/containerd/console v1.0.5 // indirect - github.com/containerd/containerd v1.7.32 // indirect + github.com/containerd/containerd v1.7.33 // indirect github.com/containerd/containerd/api v1.10.0 // indirect - github.com/containerd/containerd/v2 v2.2.1 // indirect + github.com/containerd/containerd/v2 v2.2.5 // indirect github.com/containerd/continuity v0.4.5 // indirect github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/errdefs/pkg v0.3.0 // indirect @@ -122,7 +122,7 @@ require ( github.com/fsnotify/fsevents v0.2.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.9.0 // indirect @@ -162,11 +162,11 @@ require ( github.com/jonboulle/clockwork v0.5.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/klauspost/compress v1.18.4 // indirect + github.com/klauspost/compress v1.18.5 // indirect github.com/kr/text v0.2.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/leodido/go-urn v1.2.4 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/lestrrat-go/blackmagic v1.0.4 // indirect github.com/lestrrat-go/dsig v1.0.0 // indirect github.com/lestrrat-go/option v1.0.1 // indirect @@ -256,13 +256,13 @@ require ( go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.uber.org/multierr v1.11.0 go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.50.0 // indirect - golang.org/x/net v0.53.0 // indirect + golang.org/x/crypto v0.53.0 // indirect + golang.org/x/net v0.55.0 // indirect golang.org/x/oauth2 v0.35.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.43.0 // indirect - golang.org/x/term v0.42.0 // indirect - golang.org/x/text v0.36.0 // indirect + golang.org/x/sync v0.21.0 // indirect + golang.org/x/sys v0.46.0 // indirect + golang.org/x/term v0.44.0 // indirect + golang.org/x/text v0.38.0 // indirect golang.org/x/time v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect @@ -282,7 +282,7 @@ require ( k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect k8s.io/kubectl v0.35.1 // indirect k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect - oras.land/oras-go/v2 v2.6.0 // indirect + oras.land/oras-go/v2 v2.6.1 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/kustomize/api v0.20.1 // indirect sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect diff --git a/go.sum b/go.sum index f57b0121..fc150b68 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA4 github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/Microsoft/hcsshim v0.14.0-rc.1 h1:qAPXKwGOkVn8LlqgBN8GS0bxZ83hOJpcjxzmlQKxKsQ= -github.com/Microsoft/hcsshim v0.14.0-rc.1/go.mod h1:hTKFGbnDtQb1wHiOWv4v0eN+7boSWAHyK/tNAaYZL0c= +github.com/Microsoft/hcsshim v0.14.1 h1:CMuB3fqQVfPdhyXhUqYdUmPUIOhJkmghCx3dJet8Cqs= +github.com/Microsoft/hcsshim v0.14.1/go.mod h1:VnzvPLyWUhxiPVsJ31P6XadxCcTogTguBFDy/1GR/OM= github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= @@ -121,12 +121,12 @@ github.com/containerd/cgroups/v3 v3.1.2 h1:OSosXMtkhI6Qove637tg1XgK4q+DhR0mX8Wi8 github.com/containerd/cgroups/v3 v3.1.2/go.mod h1:PKZ2AcWmSBsY/tJUVhtS/rluX0b1uq1GmPO1ElCmbOw= github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc= github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/containerd v1.7.32 h1:S54xuVcPxeLaYgaRABtpJ2VyVUVsy0IGf7qHBs+sbY8= -github.com/containerd/containerd v1.7.32/go.mod h1:jdwD6s/BhV4XVJGrvtziNPVA+83n66TwptVaPKprq4E= +github.com/containerd/containerd v1.7.33 h1:iAkYGC/ifR/V+0eR4iXWHNGYUF0DF2PmGV5iz4Irj5M= +github.com/containerd/containerd v1.7.33/go.mod h1:gSbSCVjPCdkfJCjyrzz7aRC+xFlqVbatNpfHfVCYGUM= github.com/containerd/containerd/api v1.10.0 h1:5n0oHYVBwN4VhoX9fFykCV9dF1/BvAXeg2F8W6UYq1o= github.com/containerd/containerd/api v1.10.0/go.mod h1:NBm1OAk8ZL+LG8R0ceObGxT5hbUYj7CzTmR3xh0DlMM= -github.com/containerd/containerd/v2 v2.2.1 h1:TpyxcY4AL5A+07dxETevunVS5zxqzuq7ZqJXknM11yk= -github.com/containerd/containerd/v2 v2.2.1/go.mod h1:NR70yW1iDxe84F2iFWbR9xfAN0N2F0NcjTi1OVth4nU= +github.com/containerd/containerd/v2 v2.2.5 h1:KTFzB02LviYmmfRmz8r9UFd+n6YlddVFK+5lbgQXUTU= +github.com/containerd/containerd/v2 v2.2.5/go.mod h1:5t2+xFv2dGd/iDYp9Z8DXB4cmWrWQi1XqxGJPS2gBzU= github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= @@ -230,8 +230,8 @@ github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQ github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -294,8 +294,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k= -github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= @@ -405,8 +405,8 @@ github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4 github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c= -github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= +github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -425,8 +425,8 @@ github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA= github.com/lestrrat-go/blackmagic v1.0.4/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw= github.com/lestrrat-go/dsig v1.0.0 h1:OE09s2r9Z81kxzJYRn07TFM9XA4akrUdoMwr0L8xj38= @@ -520,8 +520,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= -github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= +github.com/oapi-codegen/nullable v1.1.0 h1:eAh8JVc5430VtYVnq00Hrbpag9PFRGWLjxR1/3KntMs= +github.com/oapi-codegen/nullable v1.1.0/go.mod h1:KUZ3vUzkmEKY90ksAmit2+5juDIhIZhfDl+0PwOQlFY= +github.com/oapi-codegen/runtime v1.6.0 h1:7Xx+GlueD6nRuyKoCPzL434Jfi3BetbiJOrzCHp/VPU= +github.com/oapi-codegen/runtime v1.6.0/go.mod h1:GwV7hC2hviaMzj+ITfHVRESK5J2W/GefVwIND/bMGvU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= @@ -652,8 +654,6 @@ github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKk github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -662,9 +662,6 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -769,12 +766,12 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= -golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto= +golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= -golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -783,8 +780,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -793,8 +790,8 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -814,25 +811,25 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc= +golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= -golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -905,8 +902,8 @@ k8s.io/kubectl v0.35.1 h1:zP3Er8C5i1dcAFUMh9Eva0kVvZHptXIn/+8NtRWMxwg= k8s.io/kubectl v0.35.1/go.mod h1:cQ2uAPs5IO/kx8R5s5J3Ihv3VCYwrx0obCXum0CvnXo= k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc= -oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o= +oras.land/oras-go/v2 v2.6.1 h1:bonOEkjLfp8tt6qXWRRWP6p1F+9octchOf2EqnWB4Zs= +oras.land/oras-go/v2 v2.6.1/go.mod h1:dhtFrFOuZuDtAVeZ9FUnaa5zfzplG3ZnFX9/uH1J/Yk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/kustomize/api v0.20.1 h1:iWP1Ydh3/lmldBnH/S5RXgT98vWYMaTUL1ADcr+Sv7I= diff --git a/helmchart/config/config.yaml b/helmchart/config/config.yaml index 25621910..5bd9f95c 100644 --- a/helmchart/config/config.yaml +++ b/helmchart/config/config.yaml @@ -1,6 +1,8 @@ logging: # Log level (e.g., DEBUG, INFO, WARN, ERROR, FATAL) level: DEBUG +database: + dataDir: "/var/lib/margo/device-agent/data" # directory where databse data is stored. # The device's root identity/attestation used for onboarding/registration of this device client with WFM (for auto-onboarding). deviceRootIdentity: diff --git a/poc/device/agent/config/capabilities.json b/poc/device/agent/config/capabilities.json index 36c5fd13..379d34e7 100644 --- a/poc/device/agent/config/capabilities.json +++ b/poc/device/agent/config/capabilities.json @@ -2,20 +2,38 @@ "apiVersion": "device.margo.org/v1alpha1", "kind": "DeviceCapabilitiesManifest", "properties": { - "id": "device-id-from-manufacturer", - "vendor": "Northstar Industrial Applications", + "id": "northstarida.xtapro.k8s.edge", + "vendor": "Northstar Industrial Devices", "modelNumber": "332ANZE1-N1", "serialNumber": "PF45343-AA", - "roles": ["Standalone Cluster"], - "resources": { - "cpu": { - "architecture": "amd64", - "cores": 24 + "cpu": [ + { + "cores": 24, + "architecture": "amd64" + } + ], + "memory": "59 Gi", + "storage": "1862 Gi", + "peripherals": [ + { + "type": "gpu", + "manufacturer": "NVIDIA" + } + ], + "interfaces": [ + { + "type": "ethernet" }, - "memory": "64 Gi", - "storage": "2000 Gi", - "peripherals": [], - "interfaces": [] - } + { + "type": "wifi" + } + ], + "otelCollector": true, + "supportedRuntimes": [ + "oci" + ], + "supportedDeploymentTypes": [ + "compose" + ] } } diff --git a/poc/device/agent/config/config.yaml b/poc/device/agent/config/config.yaml index 70ec353e..598d7a65 100644 --- a/poc/device/agent/config/config.yaml +++ b/poc/device/agent/config/config.yaml @@ -1,6 +1,8 @@ logging: # Log level (e.g., DEBUG, INFO, WARN, ERROR, FATAL) level: DEBUG +database: + dataDir: "/var/lib/margo/device-agent/data" # directory where databse data is stored. # The device's root identity/attestation used for onboarding/registration of this device client with WFM (for auto-onboarding). deviceRootIdentity: diff --git a/poc/device/agent/data/agent.database.json b/poc/device/agent/data/agent.database.json deleted file mode 100644 index 371a4499..00000000 --- a/poc/device/agent/data/agent.database.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "deployments": {}, - "deviceSettings": { - "deviceId": "", - "deviceSignature": "c2lnbi0xMDQtdGhpcy1pcy1hLXRlc3Qtc2lnbmF0dXJlLWJpbmRlZC10by10aGlzLWRldmljZS1vbmx5", - "state": "", - "authEnabled": false, - "clientId": "", - "clientSecret": "", - "tokenEndpointUrl": "", - "CanDeployHelm": true, - "CanDeployCompose": false - } -} \ No newline at end of file diff --git a/poc/device/agent/database/database.go b/poc/device/agent/database/database.go index 5babae0d..867b0060 100644 --- a/poc/device/agent/database/database.go +++ b/poc/device/agent/database/database.go @@ -68,8 +68,8 @@ type DeviceSettingsRecord struct { // OAuthTokenEndpointUrl The URL for the OAuth 2.0 token endpoint. OAuthTokenEndpointUrl string `json:"tokenEndpointUrl"` // the applications that the device can deploy - CanDeployHelm bool - CanDeployCompose bool + SupportedDeploymentTypes []sbi.DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes `json:"supportedDeploymentTypes"` + SupportedRuntimes []sbi.DeviceCapabilitiesManifestPropertiesSupportedRuntimes `json:"supportedRuntimes"` // Added these new fields for sync state management LastSyncedETag string `json:"lastSyncedETag"` @@ -176,6 +176,13 @@ func (db *Database) SetLastSyncedBundleDigest(digest string) error { } func NewDatabase(dataDir string) *Database { + + err := os.MkdirAll(dataDir, 0750) + // cannot create data directory, in that case, cannot proceed + if err != nil { + panic(fmt.Sprintf("failed to create database directory, err %s", err.Error())) + } + db := &Database{ deployments: make(map[string]*DeploymentRecord), deviceSettings: &DeviceSettingsRecord{}, @@ -297,10 +304,13 @@ func (db *Database) notify( func (db *Database) SetDesiredState(deploymentId string, state AppDeploymentState) error { db.mu.Lock() + + defer db.TriggerDataPersist() defer db.mu.Unlock() record, exists := db.deployments[deploymentId] if !exists { + // initialise a record object record = &DeploymentRecord{ AppID: deploymentId, DeploymentID: deploymentId, @@ -308,13 +318,8 @@ func (db *Database) SetDesiredState(deploymentId string, state AppDeploymentStat Phase: "pending", LastUpdated: time.Now(), } - db.deployments[deploymentId] = record - db.notify(deploymentId, record, DeploymentChangeTypeDesiredStateAdded) } - // Only update if actually different - // if record.DesiredState == nil || record.DesiredState.AppDeploymentYAMLHash != - // state.AppDeploymentYAMLHash { record.DesiredState = &state record.LastUpdated = time.Now() // Store the digest and URL from the state @@ -324,11 +329,11 @@ func (db *Database) SetDesiredState(deploymentId string, state AppDeploymentStat if state.URL != nil { record.URL = *state.URL } + // record should be updated in db after assigning all fields in record + db.deployments[deploymentId] = record db.notify(deploymentId, record, DeploymentChangeTypeDesiredStateAdded) - db.TriggerDataPersist() - return nil } @@ -478,15 +483,11 @@ func (db *Database) IsDeviceOnboarded() (*DeviceSettingsRecord, bool, error) { return db.deviceSettings, db.deviceSettings.State == types.DeviceOnboardStateOnboarded, nil } -func (db *Database) SetDeviceCanDeployHelm(deployable bool) { - db.deviceSettings.CanDeployHelm = deployable -} - -func (db *Database) SetDeviceCanDeployCompose(deployable bool) { - db.deviceSettings.CanDeployCompose = deployable -} - func (db *Database) CanDeployAppProfile(profileType string) bool { - return (strings.ToLower(profileType) == "helm" && db.deviceSettings.CanDeployHelm) || - (strings.ToLower(profileType) == "compose" && db.deviceSettings.CanDeployCompose) + for _, dt := range db.deviceSettings.SupportedDeploymentTypes { + if string(dt) == strings.ToLower(profileType) { + return true + } + } + return false } diff --git a/poc/device/agent/deployment.go b/poc/device/agent/deployment.go index 781895e9..5199ecc8 100644 --- a/poc/device/agent/deployment.go +++ b/poc/device/agent/deployment.go @@ -240,7 +240,7 @@ func (dm *DeploymentManager) deployOrUpdate( profileType := appDeployment.Spec.DeploymentProfile.Type switch profileType { - case sbi.Helm: + case sbi.AppDeploymentProfileTypeHelm: // Check if Helm client is available if dm.helmClient == nil { err = fmt.Errorf( @@ -250,7 +250,7 @@ func (dm *DeploymentManager) deployOrUpdate( err = dm.deployOrUpdateHelm(ctx, deploymentId, appDeployment) } - case sbi.Compose: + case sbi.AppDeploymentProfileTypeCompose: // Check if Compose client is available if dm.composeClient == nil { err = fmt.Errorf( @@ -615,9 +615,9 @@ func (dm *DeploymentManager) remove(ctx context.Context, deploymentId string) { var removeErr error switch profileType { - case sbi.Helm: + case sbi.AppDeploymentProfileTypeHelm: removeErr = dm.removeHelm(ctx, deploymentId, appDeployment) - case sbi.Compose: + case sbi.AppDeploymentProfileTypeCompose: removeErr = dm.removeCompose(ctx, deploymentId, appDeployment) default: dm.log.Warnw( diff --git a/poc/device/agent/main.go b/poc/device/agent/main.go index bcc6ed3e..eef83e12 100644 --- a/poc/device/agent/main.go +++ b/poc/device/agent/main.go @@ -51,9 +51,10 @@ func NewAgent(configPath string) (*Agent, error) { if err != nil { return nil, err } + log.Debugw("printing database location from config", "dbDir", cfg.Database.DataDir) // Create database - db := database.NewDatabase("data/") + db := database.NewDatabase(cfg.Database.DataDir) // Prepare request editors (e.g., request signer) for WFM client clientOptions := []wfm.HTTPApiClientOptions{} @@ -190,8 +191,8 @@ func NewAgent(configPath string) (*Agent, error) { "hasValidDeviceCertificate", hasValidDeviceCertificate, "hasServerTLSVerificationEnabled", hasServerTLSVerificationEnabled, "canSignRequests", hasRequestSigningKey, - "canDeployHelm", deviceSettings.canDeployHelm, - "canDeployCompose", deviceSettings.canDeployCompose, + "supportedDeploymentTypes", deviceSettings.supportedDeploymentTypes, + "supportedRuntimes", deviceSettings.supportedRuntimes, "isAuthEnabled", deviceSettings.authEnabled, // "hasClientId", len(deviceSettings.oauthClientId) != 0, // "hasClientSecret", len(deviceSettings.oAuthClientSecret) != 0, diff --git a/poc/device/agent/onboarding.go b/poc/device/agent/onboarding.go index 5f5b13b1..7313c0f1 100644 --- a/poc/device/agent/onboarding.go +++ b/poc/device/agent/onboarding.go @@ -15,9 +15,7 @@ import ( type DeviceClientSettings struct { deviceClientId string - // a temporary solution to simulate oem based device, later on once the onboarding story is - // clear - // we can go ahead and implement something better over here + deviceRootIdentity types.DeviceRootIdentity authEnabled bool wfmEndpointsForClient []string @@ -25,35 +23,47 @@ type DeviceClientSettings struct { log *zap.SugaredLogger apiClient wfm.SBIAPIClientInterface db database.DatabaseIfc - canDeployHelm, canDeployCompose bool + supportedDeploymentTypes []sbi.DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes + supportedRuntimes []sbi.DeviceCapabilitiesManifestPropertiesSupportedRuntimes } type Option = func(auth *DeviceClientSettings) -func WithDeviceClientID(id string) Option { +func WithEnableComposeDeployment() Option { return func(auth *DeviceClientSettings) { - auth.deviceClientId = id + auth.supportedDeploymentTypes = append( + auth.supportedDeploymentTypes, + sbi.DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesCompose, + ) } } -func WithEnableAuth(oauthClientId, oauthClientSecret, tokenUrl string) Option { +func WithEnableHelmDeployment() Option { return func(auth *DeviceClientSettings) { - auth.authEnabled = true - auth.oauthClientId = oauthClientId - auth.oAuthClientSecret = oauthClientSecret - auth.oauthTokenUrl = tokenUrl + auth.supportedDeploymentTypes = append( + auth.supportedDeploymentTypes, + sbi.DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesHelm, + ) + + auth.supportedRuntimes = append( + auth.supportedRuntimes, + sbi.Oci, + ) } } -func WithEnableComposeDeployment() Option { +func WithDeviceClientID(id string) Option { return func(auth *DeviceClientSettings) { - auth.canDeployCompose = true + auth.deviceClientId = id } } -func WithEnableHelmDeployment() Option { +func WithEnableAuth(oauthClientId, oauthClientSecret, tokenUrl string) Option { return func(auth *DeviceClientSettings) { - auth.canDeployHelm = true + auth.authEnabled = true + auth.oauthClientId = oauthClientId + auth.oAuthClientSecret = oauthClientSecret + auth.oauthTokenUrl = tokenUrl } } @@ -74,9 +84,11 @@ func NewDeviceSettings( return nil, fmt.Errorf("failed to get device settings from database, %s", err.Error()) } - canDeployHelm, canDeployCompose := false, false deviceClientId, deviceRootIdentity := "", types.DeviceRootIdentity{} authEnabled, oauthClientId, oauthClientSecret, oauthTokenUrl := false, "", "", "" + var supportedDeploymentTypes []sbi.DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes + var supportedRuntimes []sbi.DeviceCapabilitiesManifestPropertiesSupportedRuntimes + if existingRecord != nil { deviceClientId = existingRecord.DeviceClientId deviceRootIdentity = existingRecord.DeviceRootIdentity @@ -84,42 +96,40 @@ func NewDeviceSettings( oauthClientId = existingRecord.OAuthClientId oauthClientSecret = existingRecord.OAuthClientSecret oauthTokenUrl = existingRecord.OAuthTokenEndpointUrl - canDeployHelm = existingRecord.CanDeployHelm - canDeployCompose = existingRecord.CanDeployCompose + supportedDeploymentTypes = existingRecord.SupportedDeploymentTypes + supportedRuntimes = existingRecord.SupportedRuntimes } settings := &DeviceClientSettings{ - deviceClientId: deviceClientId, - deviceRootIdentity: deviceRootIdentity, - apiClient: client, - log: log, - db: db, - authEnabled: authEnabled, - oauthClientId: oauthClientId, - oAuthClientSecret: oauthClientSecret, - oauthTokenUrl: oauthTokenUrl, - canDeployHelm: canDeployHelm, - canDeployCompose: canDeployCompose, + deviceClientId: deviceClientId, + deviceRootIdentity: deviceRootIdentity, + apiClient: client, + log: log, + db: db, + authEnabled: authEnabled, + oauthClientId: oauthClientId, + oAuthClientSecret: oauthClientSecret, + oauthTokenUrl: oauthTokenUrl, + supportedDeploymentTypes: supportedDeploymentTypes, + supportedRuntimes: supportedRuntimes, } for _, opt := range opts { opt(settings) } - // NOTE: need to move this out of here, not a good pattern newDeviceRecord := database.DeviceSettingsRecord{} if existingRecord != nil { newDeviceRecord = *existingRecord } - newDeviceRecord.CanDeployCompose = settings.canDeployCompose - newDeviceRecord.CanDeployHelm = settings.canDeployHelm + newDeviceRecord.SupportedDeploymentTypes = settings.supportedDeploymentTypes + newDeviceRecord.SupportedRuntimes = settings.supportedRuntimes newDeviceRecord.AuthEnabled = settings.authEnabled newDeviceRecord.DeviceClientId = settings.deviceClientId newDeviceRecord.DeviceRootIdentity = settings.deviceRootIdentity newDeviceRecord.OAuthClientId = settings.oauthClientId newDeviceRecord.OAuthClientSecret = settings.oAuthClientSecret newDeviceRecord.OAuthTokenEndpointUrl = settings.oauthTokenUrl - // s.State = settings. if err := db.SetDeviceSettings(newDeviceRecord); err != nil { return nil, err @@ -145,22 +155,21 @@ func (da *DeviceClientSettings) Onboard(ctx context.Context) (deviceClientId str da.deviceClientId = clientId da.wfmEndpointsForClient = wfmEndpointsForClient - da.oauthClientId = "" da.oAuthClientSecret = "" da.oauthTokenUrl = "" da.log.Infow("Device onboarding successful", "deviceClientId", da.deviceClientId) err = da.db.SetDeviceSettings(database.DeviceSettingsRecord{ - DeviceClientId: da.deviceClientId, - DeviceRootIdentity: da.deviceRootIdentity, - State: types.DeviceOnboardStateOnboarded, - OAuthClientId: da.oauthClientId, - OAuthClientSecret: da.oAuthClientSecret, - OAuthTokenEndpointUrl: da.oauthTokenUrl, - AuthEnabled: da.authEnabled, - CanDeployHelm: da.canDeployHelm, - CanDeployCompose: da.canDeployCompose, + DeviceClientId: da.deviceClientId, + DeviceRootIdentity: da.deviceRootIdentity, + State: types.DeviceOnboardStateOnboarded, + OAuthClientId: da.oauthClientId, + OAuthClientSecret: da.oAuthClientSecret, + OAuthTokenEndpointUrl: da.oauthTokenUrl, + AuthEnabled: da.authEnabled, + SupportedDeploymentTypes: da.supportedDeploymentTypes, + SupportedRuntimes: da.supportedRuntimes, }) return da.deviceClientId, err @@ -176,7 +185,6 @@ func (da *DeviceClientSettings) OnboardWithRetries( for retries > 0 { retries-- - // Wait for next tick or overall timeout <-ticker.C deviceClientId, err := da.Onboard(ctx) diff --git a/poc/device/agent/types/config.go b/poc/device/agent/types/config.go index 928ea6c2..671003c3 100644 --- a/poc/device/agent/types/config.go +++ b/poc/device/agent/types/config.go @@ -2,6 +2,7 @@ package types import ( "encoding/json" + "errors" "fmt" "os" "path/filepath" @@ -47,6 +48,7 @@ const ( // Config struct type Config struct { Logging LoggingConfig `yaml:"logging" validate:"required"` + Database DatabaseConfig `yaml:"database" validate:"required"` DeviceRootIdentity DeviceRootIdentity `yaml:"deviceRootIdentity" validate:"required"` Wfm WFMConfig `yaml:"wfm" validate:"required"` StateSeeking StateSeekingConfig `yaml:"stateSeeking" validate:"required"` @@ -54,6 +56,10 @@ type Config struct { Runtimes []RuntimeInfo `yaml:"runtimes" validate:"required"` } +type DatabaseConfig struct { + DataDir string `yaml:"dataDir" validate:"required"` +} + type StateSeekingConfig struct { Interval uint16 `yaml:"interval" validate:"required"` } @@ -166,6 +172,10 @@ func validateConfig(config *Config) error { return fmt.Errorf("invalid configuration: %w", err) } + if config.Database.DataDir == "" { + return errors.New("database.dataDir is required in configuration") + } + // logging.level must be present if config.Logging.Level == "" { return fmt.Errorf("logging.level is required in configuration") diff --git a/poc/tests/artefacts/custom-otel-helm-app/code/app/go.mod b/poc/tests/artefacts/custom-otel-helm-app/code/app/go.mod index 98cc4dbd..d0276cd1 100644 --- a/poc/tests/artefacts/custom-otel-helm-app/code/app/go.mod +++ b/poc/tests/artefacts/custom-otel-helm-app/code/app/go.mod @@ -24,9 +24,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect go.opentelemetry.io/otel/trace v1.43.0 // indirect go.opentelemetry.io/proto/otlp v1.10.0 // indirect - golang.org/x/net v0.52.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/net v0.55.0 // indirect + golang.org/x/sys v0.45.0 // indirect + golang.org/x/text v0.37.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect google.golang.org/grpc v1.80.0 // indirect diff --git a/poc/tests/artefacts/custom-otel-helm-app/code/app/go.sum b/poc/tests/artefacts/custom-otel-helm-app/code/app/go.sum index 72ca92f1..b0a77288 100644 --- a/poc/tests/artefacts/custom-otel-helm-app/code/app/go.sum +++ b/poc/tests/artefacts/custom-otel-helm-app/code/app/go.sum @@ -1,25 +1,14 @@ -cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= -cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.31.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= -github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98= -github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= -github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA= -github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -28,19 +17,12 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/detectors/gcp v1.39.0/go.mod h1:t/OGqzHBa5v6RHZwrDBJ2OirWc+4q/w2fTbLZwAKjTk= go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.43.0 h1:w1K+pCJoPpQifuVpsKamUdn9U0zM3xUziVOqsGksUrY= @@ -61,19 +43,12 @@ go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpu go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= -golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= -golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA= @@ -84,6 +59,5 @@ google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/scripts/device-agent.sh b/scripts/device-agent.sh index 31f4621e..b516a18a 100644 --- a/scripts/device-agent.sh +++ b/scripts/device-agent.sh @@ -115,7 +115,7 @@ source "${SCRIPT_DIR}/modules/harbor.sh" source "${SCRIPT_DIR}/modules/certificates.sh" source "${SCRIPT_DIR}/modules/agent.sh" source "${SCRIPT_DIR}/modules/observability.sh" - +source "${SCRIPT_DIR}/modules/dns-host-config.sh" export GOINSECURE='github.com/margo/*' export GONOPROXY='github.com/margo/*' @@ -178,6 +178,9 @@ install_prerequisites() { if [ "$DEVICE_TYPE" = "k3s" ]; then setup_k3s configure_harbor_trust_for_k3s + echo "Waiting for k3s to stabilize..." + sleep 5 + configure_coredns_hosts fi echo 'prerequisites installation completed.' diff --git a/scripts/easy-cli/cli-common.sh b/scripts/easy-cli/cli-common.sh index 9ba6fdcd..380c47a2 100644 --- a/scripts/easy-cli/cli-common.sh +++ b/scripts/easy-cli/cli-common.sh @@ -152,3 +152,51 @@ get_device_id_by_role() { return 1 fi } + +# Get device ID by supportedDeploymentTypes +get_device_id_by_deployment_type() { + local deployment_type="$1" + + if [ -z "$deployment_type" ]; then + echo "❌ Error: Deployment type parameter is required" + return 1 + fi + + if ! check_maestro_cli; then + echo "❌ Maestro CLI not available" + return 1 + fi + + local devices=$(${MAESTRO_CLI_PATH}/maestro wfm --host "$EXPOSED_SYMPHONY_HOST" --port "$EXPOSED_SYMPHONY_PORT" list devices -o json 2>/dev/null) + + if [ $? -ne 0 ] || [ -z "$devices" ]; then + echo "❌ Failed to get device list" + return 1 + fi + + echo "DEBUG: Raw devices JSON output below:" >&2 + echo "$devices" >&2 + + + if command -v jq >/dev/null 2>&1; then + # 1. Correct path: .spec.capabilities.properties.supportedDeploymentTypes[] + # 2. Iterate through all Data[] items, not just Data[0] + local device_id=$(echo "$devices" | jq -r --arg deployment_type "$deployment_type" ' + .Data[] | + .items[] | + select(.spec.capabilities.properties.supportedDeploymentTypes[]? == $deployment_type) | + .id + ' | head -1) + + if [ -z "$device_id" ] || [ "$device_id" = "null" ]; then + echo "❌ No device found with deployment type(s): $deployment_type" + return 1 + fi + + echo "$device_id" + return 0 + else + echo "❌ jq is required but not installed" + return 1 + fi +} diff --git a/scripts/modules/agent.sh b/scripts/modules/agent.sh index 83cee10b..584cfdcd 100644 --- a/scripts/modules/agent.sh +++ b/scripts/modules/agent.sh @@ -32,6 +32,21 @@ set_capabilities_roles() { fi } +set_capabilities_deployment_type() { + local file="./config/capabilities.json" + + if [[ -f "$file" ]]; then + jq '.properties.supportedDeploymentTypes = $ARGS.positional' \ + "$file" \ + --args "$@" > "${file}.tmp" && + mv "${file}.tmp" "$file" + echo "capabilities.json deployment type set to" + jq -c '.properties.supportedDeploymentTypes' "$file" + else + echo "capabilities.json not found at $file, skipping deployment type update" + fi +} + enable_kubernetes_runtime() { CONFIG_FILE="$HOME/sandbox/helmchart/config/config.yaml" echo "Enabling Kubernetes section in config.yaml for ServiceAccount authentication..." @@ -145,7 +160,6 @@ start_device_agent_docker_service() { cd "$HOME/sandbox/docker-compose" mkdir -p config - set_capabilities_roles "Standalone Device" if [ -f "$HOME/certs/device-private.key" ] && [ -f "$HOME/certs/device-public.crt" ] && [ -f "$HOME/certs/device-ecdsa.crt" ] && [ -f "$HOME/certs/device-ecdsa.key" ] && [ -f "$HOME/certs/ca-cert.pem" ]; then echo "Creating TLS secrets..." @@ -162,6 +176,7 @@ start_device_agent_docker_service() { cp ../poc/device/agent/config/capabilities.json ./config/ cp ../poc/device/agent/config/config.yaml ./config/ + set_capabilities_deployment_type compose mkdir -p data enable_docker_runtime @@ -249,12 +264,12 @@ build_start_device_agent_k3s_service() { return 1 fi - set_capabilities_roles "Standalone Cluster" update_agent_sbi_url echo "Copying configuration files..." mkdir -p config cp -r ../poc/device/agent/config/* ./config + set_capabilities_deployment_type helm if [ $? -eq 0 ]; then echo "✅ Configuration files copied successfully" diff --git a/scripts/modules/dns-host-config.sh b/scripts/modules/dns-host-config.sh new file mode 100644 index 00000000..33d2b3dd --- /dev/null +++ b/scripts/modules/dns-host-config.sh @@ -0,0 +1,154 @@ +#!/bin/bash + +#------------------------------------------------------------------------------ +# Returns the IPv4 address of the specified hostname from /etc/hosts. +#------------------------------------------------------------------------------ +get_ip_from_hosts() { + local hostname="$1" + local hosts_file="/etc/hosts" + local ip + + if [[ ! -r "$hosts_file" ]]; then + echo "[ERROR] Unable to read ${hosts_file}." >&2 + return 1 + fi + + ip=$( + awk -v host="$hostname" ' + /^[[:space:]]*#/ { next } + NF >= 2 && $2 == host { + print $1 + exit + } + ' "$hosts_file" + ) + + if [[ -z "$ip" ]]; then + echo "[ERROR] Host '${hostname}' not found in ${hosts_file}." >&2 + return 1 + fi + + if [[ ! "$ip" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then + echo "[ERROR] Invalid IPv4 address '${ip}' for '${hostname}'." >&2 + return 1 + fi + + printf '%s\n' "$ip" +} + +#------------------------------------------------------------------------------ +# Adds or updates NodeHosts entries in the CoreDNS ConfigMap. +#------------------------------------------------------------------------------ + +add_or_update_host() { + local ip="$1" + local host="$2" + + if awk -v host="$host" ' + /^[[:space:]]*#/ { next } + $2 == host { found=1 } + END { exit !found } + ' <<<"$updated"; then + + updated=$( + awk -v ip="$ip" -v host="$host" ' + /^[[:space:]]*#/ { + print + next + } + + $2 == host { + print ip " " host + next + } + + { + print + } + ' <<<"$updated" + ) + + else + if [[ -n "$updated" ]]; then + updated+=$'\n' + fi + updated+="${ip} ${host}" + fi +} + +configure_coredns_hosts() { + set -euo pipefail + + local namespace="kube-system" + local configmap="coredns" + + local harbor_host="${EXPOSED_HARBOR_HOST}" + local symphony_host="${WFM_HOST}" + + local harbor_ip + local symphony_ip + + local nodehosts + local updated + + echo "[INFO] Validating dependencies..." + + for cmd in kubectl jq awk sed; do + if ! command -v "$cmd" >/dev/null 2>&1; then + echo "[ERROR] Required command '$cmd' is not installed." >&2 + return 1 + fi + done + + echo "[INFO] Reading IP addresses from /etc/hosts..." + + harbor_ip=$(get_ip_from_hosts "$harbor_host") + symphony_ip=$(get_ip_from_hosts "$symphony_host") + + echo "[INFO] Verifying CoreDNS ConfigMap..." + + if ! kubectl -n "$namespace" get configmap "$configmap" >/dev/null 2>&1; then + echo "[ERROR] ConfigMap '${configmap}' not found in namespace '${namespace}'." >&2 + return 1 + fi + + nodehosts=$( + kubectl -n "$namespace" get configmap "$configmap" \ + -o jsonpath='{.data.NodeHosts}' 2>/dev/null || true + ) + + updated="$nodehosts" + + add_or_update_host "$harbor_ip" "$harbor_host" + add_or_update_host "$symphony_ip" "$symphony_host" + + updated=$(sed '/^[[:space:]]*$/d' <<<"$updated") + + if [[ "$updated" == "$nodehosts" ]]; then + echo "[INFO] CoreDNS NodeHosts already up to date." + return 0 + fi + + echo "[INFO] Updating CoreDNS ConfigMap..." + + kubectl -n "$namespace" patch configmap "$configmap" \ + --type merge \ + --patch "$(cat <&2 - echo "Usage: $0 {list-packages|list-devices|list-deployments|list-all-non-interactive|upload|upload-app-non-interactive|delete-package|delete-package-non-interactive|deploy|deploy-non-interactive|delete-instance|delete-instance-non-interactive|get-package-id-by-name|get-device-id-by-role}" + echo "Usage: $0 {list-packages|list-devices|list-deployments|list-all-non-interactive|upload|upload-app-non-interactive|delete-package|delete-package-non-interactive|deploy|deploy-non-interactive|delete-instance|delete-instance-non-interactive|get-package-id-by-name|get-device-id-by-role|get-device-id-by-deployment-type}" exit 1 ;; esac diff --git a/standard/generate.sh b/standard/generate.sh index 2fa45e10..13cab84f 100644 --- a/standard/generate.sh +++ b/standard/generate.sh @@ -6,7 +6,7 @@ export PATH="$PATH:$HOME/go/bin" #WFM_SBI_SPEC=("spec/wfm-sbi.yaml") TMP_SPEC="snapshot.spec.yaml" -SPEC_URL="https://raw.githubusercontent.com/margo/specification/pre-draft/system-design/specification/margo-management-interface/workload-management-api-1.0.0.yaml" +SPEC_URL="https://raw.githubusercontent.com/margo/specification/pre-draft/system-design/specification/margo-management-interface/workload-management-api-1.0.0-rc.2.yaml" curl -sSL -o "$TMP_SPEC" \ "$SPEC_URL" WFM_SBI_SPEC="$TMP_SPEC" @@ -44,7 +44,7 @@ check_prerequisites() { install_tools() { log_info "Installing oapi-codegen..." # TODO: fix the codegen version - go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest + go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest log_success "oapi-codegen installed" } diff --git a/standard/generatedCode/wfm/sbi/client.go b/standard/generatedCode/wfm/sbi/client.go index a8de15d0..180b6386 100644 --- a/standard/generatedCode/wfm/sbi/client.go +++ b/standard/generatedCode/wfm/sbi/client.go @@ -1,6 +1,6 @@ // Package sbi provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.16.3 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT. package sbi import ( @@ -13,12 +13,12 @@ import ( "net/url" "strings" - "gopkg.in/yaml.v2" + "go.yaml.in/yaml/v3" "github.com/oapi-codegen/runtime" ) -// RequestEditorFn is the function signature for the RequestEditor callback function +// RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error // Doer performs HTTP requests. @@ -91,42 +91,94 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // GetApiV1ClientsClientIdBundlesDigest request + + // GetApiV1ClientsClientIdBundlesDigest Retrieve bundle information for a specific device and digest + // + // Corresponds with GET /api/v1/clients/{clientId}/bundles/{digest} (the `GetApiV1ClientsClientIdBundlesDigest` operationId). GetApiV1ClientsClientIdBundlesDigest(ctx context.Context, clientId string, digest string, params *GetApiV1ClientsClientIdBundlesDigestParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteApiV1ClientsClientIdCapabilitiesDeviceId request + // DeleteApiV1ClientsClientIdCapabilitiesDeviceId Remove device (Unregister) + // + // Corresponds with DELETE /api/v1/clients/{clientId}/capabilities/{deviceId} (the `DeleteApiV1ClientsClientIdCapabilitiesDeviceId` operationId). DeleteApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody request with any body + // PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody Report device capabilities + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostApiV1ClientsClientIdCapabilitiesDeviceId Report device capabilities + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PostApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, body PostApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody request with any body + // PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody Update device capabilities (Update) + // + // Takes any type of body and a specified content type. + // + // Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PutApiV1ClientsClientIdCapabilitiesDeviceId Update device capabilities (Update) + // + // Takes a body of the `application/json` content type. + // + // Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PutApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, body PutApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiV1ClientsClientIdDeployments request + // GetApiV1ClientsClientIdDeployments Retrieve the complete desired state for all workloads assigned to a device + // + // Corresponds with GET /api/v1/clients/{clientId}/deployments (the `GetApiV1ClientsClientIdDeployments` operationId). GetApiV1ClientsClientIdDeployments(ctx context.Context, clientId string, params *GetApiV1ClientsClientIdDeploymentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody request with any body + // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody Report deployment status + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody(ctx context.Context, clientId string, deploymentId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus Report deployment status + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus(ctx context.Context, clientId string, deploymentId string, body PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest request + // GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest Retrieve an individual ApplicationDeployment YAML file + // + // This endpoint is used by the client to fetch the YAML for a single ApplicationDeployment after it has processed a new State Manifest and identified a small number of new or updated deployments. This allows for highly efficient, incremental updates without needing to download the full bundle. To make individual workload retrievals race-free and cache-friendly, this endpoint is content-addressable: the digest of the expected YAML is part of the URL. This guarantees immutability of the fetched resource and prevents a time-of-check / time-of-use race where a deployment changes between manifest retrieval and content fetch. + // + // Corresponds with GET /api/v1/clients/{clientId}/deployments/{deploymentId}/{digest} (the `GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest` operationId). GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest(ctx context.Context, clientId string, deploymentId string, digest string, params *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostApiV1OnboardingWithBody request with any body + // PostApiV1OnboardingWithBody Complete onboarding with client certificate + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). PostApiV1OnboardingWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostApiV1Onboarding Complete onboarding with client certificate + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). PostApiV1Onboarding(ctx context.Context, body PostApiV1OnboardingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetApiV1OnboardingCertificate request + // GetApiV1OnboardingCertificate Download Root CA certificate + // + // Corresponds with GET /api/v1/onboarding/certificate (the `GetApiV1OnboardingCertificate` operationId). GetApiV1OnboardingCertificate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) } +// GetApiV1ClientsClientIdBundlesDigest Retrieve bundle information for a specific device and digest +// +// Corresponds with GET /api/v1/clients/{clientId}/bundles/{digest} (the `GetApiV1ClientsClientIdBundlesDigest` operationId). func (c *Client) GetApiV1ClientsClientIdBundlesDigest(ctx context.Context, clientId string, digest string, params *GetApiV1ClientsClientIdBundlesDigestParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV1ClientsClientIdBundlesDigestRequest(c.Server, clientId, digest, params) if err != nil { @@ -139,6 +191,9 @@ func (c *Client) GetApiV1ClientsClientIdBundlesDigest(ctx context.Context, clien return c.Client.Do(req) } +// DeleteApiV1ClientsClientIdCapabilitiesDeviceId Remove device (Unregister) +// +// Corresponds with DELETE /api/v1/clients/{clientId}/capabilities/{deviceId} (the `DeleteApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *Client) DeleteApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteApiV1ClientsClientIdCapabilitiesDeviceIdRequest(c.Server, clientId, deviceId) if err != nil { @@ -151,6 +206,11 @@ func (c *Client) DeleteApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Cont return c.Client.Do(req) } +// PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody Report device capabilities +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *Client) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(c.Server, clientId, deviceId, contentType, body) if err != nil { @@ -163,6 +223,11 @@ func (c *Client) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx contex return c.Client.Do(req) } +// PostApiV1ClientsClientIdCapabilitiesDeviceId Report device capabilities +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *Client) PostApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, body PostApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequest(c.Server, clientId, deviceId, body) if err != nil { @@ -175,6 +240,11 @@ func (c *Client) PostApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Contex return c.Client.Do(req) } +// PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody Update device capabilities (Update) +// +// Takes any type of body and a specified content type. +// +// Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *Client) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(c.Server, clientId, deviceId, contentType, body) if err != nil { @@ -187,6 +257,11 @@ func (c *Client) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx context return c.Client.Do(req) } +// PutApiV1ClientsClientIdCapabilitiesDeviceId Update device capabilities (Update) +// +// Takes a body of the `application/json` content type. +// +// Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *Client) PutApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context, clientId string, deviceId DeviceId, body PutApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequest(c.Server, clientId, deviceId, body) if err != nil { @@ -199,6 +274,9 @@ func (c *Client) PutApiV1ClientsClientIdCapabilitiesDeviceId(ctx context.Context return c.Client.Do(req) } +// GetApiV1ClientsClientIdDeployments Retrieve the complete desired state for all workloads assigned to a device +// +// Corresponds with GET /api/v1/clients/{clientId}/deployments (the `GetApiV1ClientsClientIdDeployments` operationId). func (c *Client) GetApiV1ClientsClientIdDeployments(ctx context.Context, clientId string, params *GetApiV1ClientsClientIdDeploymentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV1ClientsClientIdDeploymentsRequest(c.Server, clientId, params) if err != nil { @@ -211,6 +289,11 @@ func (c *Client) GetApiV1ClientsClientIdDeployments(ctx context.Context, clientI return c.Client.Do(req) } +// PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody Report deployment status +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). func (c *Client) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody(ctx context.Context, clientId string, deploymentId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody(c.Server, clientId, deploymentId, contentType, body) if err != nil { @@ -223,6 +306,11 @@ func (c *Client) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody(c return c.Client.Do(req) } +// PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus Report deployment status +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). func (c *Client) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus(ctx context.Context, clientId string, deploymentId string, body PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequest(c.Server, clientId, deploymentId, body) if err != nil { @@ -235,6 +323,11 @@ func (c *Client) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus(ctx conte return c.Client.Do(req) } +// GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest Retrieve an individual ApplicationDeployment YAML file +// +// This endpoint is used by the client to fetch the YAML for a single ApplicationDeployment after it has processed a new State Manifest and identified a small number of new or updated deployments. This allows for highly efficient, incremental updates without needing to download the full bundle. To make individual workload retrievals race-free and cache-friendly, this endpoint is content-addressable: the digest of the expected YAML is part of the URL. This guarantees immutability of the fetched resource and prevents a time-of-check / time-of-use race where a deployment changes between manifest retrieval and content fetch. +// +// Corresponds with GET /api/v1/clients/{clientId}/deployments/{deploymentId}/{digest} (the `GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest` operationId). func (c *Client) GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest(ctx context.Context, clientId string, deploymentId string, digest string, params *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest(c.Server, clientId, deploymentId, digest, params) if err != nil { @@ -247,6 +340,11 @@ func (c *Client) GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest(ctx contex return c.Client.Do(req) } +// PostApiV1OnboardingWithBody Complete onboarding with client certificate +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). func (c *Client) PostApiV1OnboardingWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1OnboardingRequestWithBody(c.Server, contentType, body) if err != nil { @@ -259,6 +357,11 @@ func (c *Client) PostApiV1OnboardingWithBody(ctx context.Context, contentType st return c.Client.Do(req) } +// PostApiV1Onboarding Complete onboarding with client certificate +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). func (c *Client) PostApiV1Onboarding(ctx context.Context, body PostApiV1OnboardingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV1OnboardingRequest(c.Server, body) if err != nil { @@ -271,6 +374,9 @@ func (c *Client) PostApiV1Onboarding(ctx context.Context, body PostApiV1Onboardi return c.Client.Do(req) } +// GetApiV1OnboardingCertificate Download Root CA certificate +// +// Corresponds with GET /api/v1/onboarding/certificate (the `GetApiV1OnboardingCertificate` operationId). func (c *Client) GetApiV1OnboardingCertificate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV1OnboardingCertificateRequest(c.Server) if err != nil { @@ -283,20 +389,20 @@ func (c *Client) GetApiV1OnboardingCertificate(ctx context.Context, reqEditors . return c.Client.Do(req) } -// NewGetApiV1ClientsClientIdBundlesDigestRequest generates requests for GetApiV1ClientsClientIdBundlesDigest +// NewGetApiV1ClientsClientIdBundlesDigestRequest constructs an http.Request for the GetApiV1ClientsClientIdBundlesDigest method func NewGetApiV1ClientsClientIdBundlesDigestRequest(server string, clientId string, digest string, params *GetApiV1ClientsClientIdBundlesDigestParams) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "digest", runtime.ParamLocationPath, digest) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "digest", digest, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -316,7 +422,7 @@ func NewGetApiV1ClientsClientIdBundlesDigestRequest(server string, clientId stri return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } @@ -326,7 +432,7 @@ func NewGetApiV1ClientsClientIdBundlesDigestRequest(server string, clientId stri if params.IfNoneMatch != nil { var headerParam0 string - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "If-None-Match", runtime.ParamLocationHeader, *params.IfNoneMatch) + headerParam0, err = runtime.StyleParamWithOptions("simple", false, "If-None-Match", *params.IfNoneMatch, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -339,20 +445,20 @@ func NewGetApiV1ClientsClientIdBundlesDigestRequest(server string, clientId stri return req, nil } -// NewDeleteApiV1ClientsClientIdCapabilitiesDeviceIdRequest generates requests for DeleteApiV1ClientsClientIdCapabilitiesDeviceId +// NewDeleteApiV1ClientsClientIdCapabilitiesDeviceIdRequest constructs an http.Request for the DeleteApiV1ClientsClientIdCapabilitiesDeviceId method func NewDeleteApiV1ClientsClientIdCapabilitiesDeviceIdRequest(server string, clientId string, deviceId DeviceId) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "deviceId", runtime.ParamLocationPath, deviceId) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "deviceId", deviceId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -372,7 +478,7 @@ func NewDeleteApiV1ClientsClientIdCapabilitiesDeviceIdRequest(server string, cli return nil, err } - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) if err != nil { return nil, err } @@ -391,20 +497,20 @@ func NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequest(server string, clien return NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server, clientId, deviceId, "application/json", bodyReader) } -// NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody generates requests for PostApiV1ClientsClientIdCapabilitiesDeviceId with any type of body +// NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody constructs an http.Request for the PostApiV1ClientsClientIdCapabilitiesDeviceId method, with any body, and a specified content type func NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server string, clientId string, deviceId DeviceId, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "deviceId", runtime.ParamLocationPath, deviceId) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "deviceId", deviceId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -424,7 +530,7 @@ func NewPostApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server strin return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -445,20 +551,20 @@ func NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequest(server string, client return NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server, clientId, deviceId, "application/json", bodyReader) } -// NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody generates requests for PutApiV1ClientsClientIdCapabilitiesDeviceId with any type of body +// NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody constructs an http.Request for the PutApiV1ClientsClientIdCapabilitiesDeviceId method, with any body, and a specified content type func NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server string, clientId string, deviceId DeviceId, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "deviceId", runtime.ParamLocationPath, deviceId) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "deviceId", deviceId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -478,7 +584,7 @@ func NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server string return nil, err } - req, err := http.NewRequest("PUT", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) if err != nil { return nil, err } @@ -488,13 +594,13 @@ func NewPutApiV1ClientsClientIdCapabilitiesDeviceIdRequestWithBody(server string return req, nil } -// NewGetApiV1ClientsClientIdDeploymentsRequest generates requests for GetApiV1ClientsClientIdDeployments +// NewGetApiV1ClientsClientIdDeploymentsRequest constructs an http.Request for the GetApiV1ClientsClientIdDeployments method func NewGetApiV1ClientsClientIdDeploymentsRequest(server string, clientId string, params *GetApiV1ClientsClientIdDeploymentsParams) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -514,7 +620,7 @@ func NewGetApiV1ClientsClientIdDeploymentsRequest(server string, clientId string return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } @@ -524,7 +630,7 @@ func NewGetApiV1ClientsClientIdDeploymentsRequest(server string, clientId string if params.IfNoneMatch != nil { var headerParam0 string - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "If-None-Match", runtime.ParamLocationHeader, *params.IfNoneMatch) + headerParam0, err = runtime.StyleParamWithOptions("simple", false, "If-None-Match", *params.IfNoneMatch, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -535,7 +641,7 @@ func NewGetApiV1ClientsClientIdDeploymentsRequest(server string, clientId string if params.Accept != nil { var headerParam1 string - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept) + headerParam1, err = runtime.StyleParamWithOptions("simple", false, "Accept", *params.Accept, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -559,20 +665,20 @@ func NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequest(server stri return NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody(server, clientId, deploymentId, "application/json", bodyReader) } -// NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody generates requests for PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus with any type of body +// NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody constructs an http.Request for the PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus method, with any body, and a specified content type func NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody(server string, clientId string, deploymentId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "deploymentId", runtime.ParamLocationPath, deploymentId) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -592,7 +698,7 @@ func NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody(ser return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -602,27 +708,27 @@ func NewPostApiV1ClientsClientIdDeploymentsDeploymentIdStatusRequestWithBody(ser return req, nil } -// NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest generates requests for GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest +// NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest constructs an http.Request for the GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest method func NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest(server string, clientId string, deploymentId string, digest string, params *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestParams) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clientId", runtime.ParamLocationPath, clientId) + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "clientId", clientId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "deploymentId", runtime.ParamLocationPath, deploymentId) + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam2 string - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "digest", runtime.ParamLocationPath, digest) + pathParam2, err = runtime.StyleParamWithOptions("simple", false, "digest", digest, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -642,7 +748,7 @@ func NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest(server strin return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } @@ -652,7 +758,7 @@ func NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest(server strin if params.IfNoneMatch != nil { var headerParam0 string - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "If-None-Match", runtime.ParamLocationHeader, *params.IfNoneMatch) + headerParam0, err = runtime.StyleParamWithOptions("simple", false, "If-None-Match", *params.IfNoneMatch, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -663,7 +769,7 @@ func NewGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestRequest(server strin if params.AcceptEncoding != nil { var headerParam1 string - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept-Encoding", runtime.ParamLocationHeader, *params.AcceptEncoding) + headerParam1, err = runtime.StyleParamWithOptions("simple", false, "Accept-Encoding", *params.AcceptEncoding, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } @@ -687,7 +793,7 @@ func NewPostApiV1OnboardingRequest(server string, body PostApiV1OnboardingJSONRe return NewPostApiV1OnboardingRequestWithBody(server, "application/json", bodyReader) } -// NewPostApiV1OnboardingRequestWithBody generates requests for PostApiV1Onboarding with any type of body +// NewPostApiV1OnboardingRequestWithBody constructs an http.Request for the PostApiV1Onboarding method, with any body, and a specified content type func NewPostApiV1OnboardingRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error @@ -706,7 +812,7 @@ func NewPostApiV1OnboardingRequestWithBody(server string, contentType string, bo return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } @@ -716,7 +822,7 @@ func NewPostApiV1OnboardingRequestWithBody(server string, contentType string, bo return req, nil } -// NewGetApiV1OnboardingCertificateRequest generates requests for GetApiV1OnboardingCertificate +// NewGetApiV1OnboardingCertificateRequest constructs an http.Request for the GetApiV1OnboardingCertificate method func NewGetApiV1OnboardingCertificateRequest(server string) (*http.Request, error) { var err error @@ -735,7 +841,7 @@ func NewGetApiV1OnboardingCertificateRequest(server string) (*http.Request, erro return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } @@ -786,45 +892,117 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // GetApiV1ClientsClientIdBundlesDigestWithResponse request + + // GetApiV1ClientsClientIdBundlesDigestWithResponse Retrieve bundle information for a specific device and digest + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /api/v1/clients/{clientId}/bundles/{digest} (the `GetApiV1ClientsClientIdBundlesDigest` operationId). GetApiV1ClientsClientIdBundlesDigestWithResponse(ctx context.Context, clientId string, digest string, params *GetApiV1ClientsClientIdBundlesDigestParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdBundlesDigestResponse, error) - // DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse request + // DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Remove device (Unregister) + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with DELETE /api/v1/clients/{clientId}/capabilities/{deviceId} (the `DeleteApiV1ClientsClientIdCapabilitiesDeviceId` operationId). DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, reqEditors ...RequestEditorFn) (*DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) - // PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse request with any body + // PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse Report device capabilities + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) + // PostApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Report device capabilities + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PostApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, body PostApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) - // PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse request with any body + // PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse Update device capabilities (Update) + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) + // PutApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Update device capabilities (Update) + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). PutApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, body PutApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) - // GetApiV1ClientsClientIdDeploymentsWithResponse request + // GetApiV1ClientsClientIdDeploymentsWithResponse Retrieve the complete desired state for all workloads assigned to a device + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /api/v1/clients/{clientId}/deployments (the `GetApiV1ClientsClientIdDeployments` operationId). GetApiV1ClientsClientIdDeploymentsWithResponse(ctx context.Context, clientId string, params *GetApiV1ClientsClientIdDeploymentsParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdDeploymentsResponse, error) - // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse request with any body + // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse Report deployment status + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse(ctx context.Context, clientId string, deploymentId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse, error) + // PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithResponse Report deployment status + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithResponse(ctx context.Context, clientId string, deploymentId string, body PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse, error) - // GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse request + // GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse Retrieve an individual ApplicationDeployment YAML file + // + // This endpoint is used by the client to fetch the YAML for a single ApplicationDeployment after it has processed a new State Manifest and identified a small number of new or updated deployments. This allows for highly efficient, incremental updates without needing to download the full bundle. To make individual workload retrievals race-free and cache-friendly, this endpoint is content-addressable: the digest of the expected YAML is part of the URL. This guarantees immutability of the fetched resource and prevents a time-of-check / time-of-use race where a deployment changes between manifest retrieval and content fetch. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /api/v1/clients/{clientId}/deployments/{deploymentId}/{digest} (the `GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest` operationId). GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse(ctx context.Context, clientId string, deploymentId string, digest string, params *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse, error) - // PostApiV1OnboardingWithBodyWithResponse request with any body + // PostApiV1OnboardingWithBodyWithResponse Complete onboarding with client certificate + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). PostApiV1OnboardingWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OnboardingResponse, error) + // PostApiV1OnboardingWithResponse Complete onboarding with client certificate + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). PostApiV1OnboardingWithResponse(ctx context.Context, body PostApiV1OnboardingJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OnboardingResponse, error) - // GetApiV1OnboardingCertificateWithResponse request + // GetApiV1OnboardingCertificateWithResponse Download Root CA certificate + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /api/v1/onboarding/certificate (the `GetApiV1OnboardingCertificate` operationId). GetApiV1OnboardingCertificateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV1OnboardingCertificateResponse, error) } +// GetApiV1ClientsClientIdBundlesDigestResponse200Headers the declared response headers of an HTTP 200 response for GetApiV1ClientsClientIdBundlesDigest +type GetApiV1ClientsClientIdBundlesDigestResponse200Headers struct { + CacheControl *string + ETag *string +} + type GetApiV1ClientsClientIdBundlesDigestResponse struct { Body []byte HTTPResponse *http.Response + // Headers200 the parsed response headers for an HTTP 200 response + Headers200 *GetApiV1ClientsClientIdBundlesDigestResponse200Headers +} + +// GetBody returns the raw response body bytes +func (r GetApiV1ClientsClientIdBundlesDigestResponse) GetBody() []byte { + return r.Body } // Status returns HTTPResponse.Status @@ -843,11 +1021,24 @@ func (r GetApiV1ClientsClientIdBundlesDigestResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetApiV1ClientsClientIdBundlesDigestResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse struct { Body []byte HTTPResponse *http.Response } +// GetBody returns the raw response body bytes +func (r DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse) Status() string { if r.HTTPResponse != nil { @@ -864,11 +1055,24 @@ func (r DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse) StatusCode() int return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse struct { Body []byte HTTPResponse *http.Response } +// GetBody returns the raw response body bytes +func (r PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse) Status() string { if r.HTTPResponse != nil { @@ -885,11 +1089,24 @@ func (r PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse struct { Body []byte HTTPResponse *http.Response } +// GetBody returns the raw response body bytes +func (r PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse) Status() string { if r.HTTPResponse != nil { @@ -906,10 +1123,37 @@ func (r PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +// GetApiV1ClientsClientIdDeploymentsResponse200Headers the declared response headers of an HTTP 200 response for GetApiV1ClientsClientIdDeployments +type GetApiV1ClientsClientIdDeploymentsResponse200Headers struct { + ContentType *string + ETag *string +} + type GetApiV1ClientsClientIdDeploymentsResponse struct { - Body []byte - HTTPResponse *http.Response + Body []byte + HTTPResponse *http.Response + // ApplicationvndMargoManifestV1JSON200 the response for an HTTP 200 `application/vnd.margo.manifest.v1+json` response ApplicationvndMargoManifestV1JSON200 *UnsignedAppStateManifest + // Headers200 the parsed response headers for an HTTP 200 response + Headers200 *GetApiV1ClientsClientIdDeploymentsResponse200Headers +} + +// GetApplicationvndMargoManifestV1JSON200 returns the response for an HTTP 200 `application/vnd.margo.manifest.v1+json` response +func (r GetApiV1ClientsClientIdDeploymentsResponse) GetApplicationvndMargoManifestV1JSON200() *UnsignedAppStateManifest { + return r.ApplicationvndMargoManifestV1JSON200 +} + +// GetBody returns the raw response body bytes +func (r GetApiV1ClientsClientIdDeploymentsResponse) GetBody() []byte { + return r.Body } // Status returns HTTPResponse.Status @@ -928,11 +1172,24 @@ func (r GetApiV1ClientsClientIdDeploymentsResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetApiV1ClientsClientIdDeploymentsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse struct { Body []byte HTTPResponse *http.Response } +// GetBody returns the raw response body bytes +func (r PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse) Status() string { if r.HTTPResponse != nil { @@ -949,10 +1206,39 @@ func (r PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse) StatusCod return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +// GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse200Headers the declared response headers of an HTTP 200 response for GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest +type GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse200Headers struct { + CacheControl *string + ContentType *string + ETag *string + Vary *string +} + type GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse struct { Body []byte HTTPResponse *http.Response - YAML200 *string + // YAML200 the response for an HTTP 200 `application/yaml` response + YAML200 *string + // Headers200 the parsed response headers for an HTTP 200 response + Headers200 *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse200Headers +} + +// GetYAML200 returns the response for an HTTP 200 `application/yaml` response +func (r GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse) GetYAML200() *string { + return r.YAML200 +} + +// GetBody returns the raw response body bytes +func (r GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse) GetBody() []byte { + return r.Body } // Status returns HTTPResponse.Status @@ -971,20 +1257,57 @@ func (r GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse) StatusCode return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type PostApiV1OnboardingResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *struct { + // JSON201 the response for an HTTP 201 `application/json` response + JSON201 *struct { ClientId *string `json:"clientId,omitempty"` } + // JSON400 the response for an HTTP 400 `application/json` response JSON400 *struct { Error *string `json:"error,omitempty"` } + // JSON403 the response for an HTTP 403 `application/json` response JSON403 *struct { Error *string `json:"error,omitempty"` } } +// GetJSON201 returns the response for an HTTP 201 `application/json` response +func (r PostApiV1OnboardingResponse) GetJSON201() *struct { + ClientId *string `json:"clientId,omitempty"` +} { + return r.JSON201 +} + +// GetJSON400 returns the response for an HTTP 400 `application/json` response +func (r PostApiV1OnboardingResponse) GetJSON400() *struct { + Error *string `json:"error,omitempty"` +} { + return r.JSON400 +} + +// GetJSON403 returns the response for an HTTP 403 `application/json` response +func (r PostApiV1OnboardingResponse) GetJSON403() *struct { + Error *string `json:"error,omitempty"` +} { + return r.JSON403 +} + +// GetBody returns the raw response body bytes +func (r PostApiV1OnboardingResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r PostApiV1OnboardingResponse) Status() string { if r.HTTPResponse != nil { @@ -1001,15 +1324,37 @@ func (r PostApiV1OnboardingResponse) StatusCode() int { return 0 } +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r PostApiV1OnboardingResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + type GetApiV1OnboardingCertificateResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *struct { + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { // Certificate Base64-encoded certificate text Certificate *string `json:"certificate,omitempty"` } } +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetApiV1OnboardingCertificateResponse) GetJSON200() *struct { + // Certificate Base64-encoded certificate text + Certificate *string `json:"certificate,omitempty"` +} { + return r.JSON200 +} + +// GetBody returns the raw response body bytes +func (r GetApiV1OnboardingCertificateResponse) GetBody() []byte { + return r.Body +} + // Status returns HTTPResponse.Status func (r GetApiV1OnboardingCertificateResponse) Status() string { if r.HTTPResponse != nil { @@ -1026,7 +1371,19 @@ func (r GetApiV1OnboardingCertificateResponse) StatusCode() int { return 0 } -// GetApiV1ClientsClientIdBundlesDigestWithResponse request returning *GetApiV1ClientsClientIdBundlesDigestResponse +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetApiV1OnboardingCertificateResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +// GetApiV1ClientsClientIdBundlesDigestWithResponse Retrieve bundle information for a specific device and digest +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /api/v1/clients/{clientId}/bundles/{digest} (the `GetApiV1ClientsClientIdBundlesDigest` operationId). func (c *ClientWithResponses) GetApiV1ClientsClientIdBundlesDigestWithResponse(ctx context.Context, clientId string, digest string, params *GetApiV1ClientsClientIdBundlesDigestParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdBundlesDigestResponse, error) { rsp, err := c.GetApiV1ClientsClientIdBundlesDigest(ctx, clientId, digest, params, reqEditors...) if err != nil { @@ -1035,7 +1392,11 @@ func (c *ClientWithResponses) GetApiV1ClientsClientIdBundlesDigestWithResponse(c return ParseGetApiV1ClientsClientIdBundlesDigestResponse(rsp) } -// DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse request returning *DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse +// DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Remove device (Unregister) +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with DELETE /api/v1/clients/{clientId}/capabilities/{deviceId} (the `DeleteApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *ClientWithResponses) DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, reqEditors ...RequestEditorFn) (*DeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) { rsp, err := c.DeleteApiV1ClientsClientIdCapabilitiesDeviceId(ctx, clientId, deviceId, reqEditors...) if err != nil { @@ -1044,7 +1405,11 @@ func (c *ClientWithResponses) DeleteApiV1ClientsClientIdCapabilitiesDeviceIdWith return ParseDeleteApiV1ClientsClientIdCapabilitiesDeviceIdResponse(rsp) } -// PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse request with arbitrary body returning *PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse +// PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse Report device capabilities +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *ClientWithResponses) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) { rsp, err := c.PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx, clientId, deviceId, contentType, body, reqEditors...) if err != nil { @@ -1053,6 +1418,11 @@ func (c *ClientWithResponses) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithBo return ParsePostApiV1ClientsClientIdCapabilitiesDeviceIdResponse(rsp) } +// PostApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Report device capabilities +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PostApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *ClientWithResponses) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, body PostApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) { rsp, err := c.PostApiV1ClientsClientIdCapabilitiesDeviceId(ctx, clientId, deviceId, body, reqEditors...) if err != nil { @@ -1061,7 +1431,11 @@ func (c *ClientWithResponses) PostApiV1ClientsClientIdCapabilitiesDeviceIdWithRe return ParsePostApiV1ClientsClientIdCapabilitiesDeviceIdResponse(rsp) } -// PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse request with arbitrary body returning *PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse +// PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse Update device capabilities (Update) +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *ClientWithResponses) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBodyWithResponse(ctx context.Context, clientId string, deviceId DeviceId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) { rsp, err := c.PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBody(ctx, clientId, deviceId, contentType, body, reqEditors...) if err != nil { @@ -1070,6 +1444,11 @@ func (c *ClientWithResponses) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithBod return ParsePutApiV1ClientsClientIdCapabilitiesDeviceIdResponse(rsp) } +// PutApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse Update device capabilities (Update) +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /api/v1/clients/{clientId}/capabilities/{deviceId} (the `PutApiV1ClientsClientIdCapabilitiesDeviceId` operationId). func (c *ClientWithResponses) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithResponse(ctx context.Context, clientId string, deviceId DeviceId, body PutApiV1ClientsClientIdCapabilitiesDeviceIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutApiV1ClientsClientIdCapabilitiesDeviceIdResponse, error) { rsp, err := c.PutApiV1ClientsClientIdCapabilitiesDeviceId(ctx, clientId, deviceId, body, reqEditors...) if err != nil { @@ -1078,7 +1457,11 @@ func (c *ClientWithResponses) PutApiV1ClientsClientIdCapabilitiesDeviceIdWithRes return ParsePutApiV1ClientsClientIdCapabilitiesDeviceIdResponse(rsp) } -// GetApiV1ClientsClientIdDeploymentsWithResponse request returning *GetApiV1ClientsClientIdDeploymentsResponse +// GetApiV1ClientsClientIdDeploymentsWithResponse Retrieve the complete desired state for all workloads assigned to a device +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /api/v1/clients/{clientId}/deployments (the `GetApiV1ClientsClientIdDeployments` operationId). func (c *ClientWithResponses) GetApiV1ClientsClientIdDeploymentsWithResponse(ctx context.Context, clientId string, params *GetApiV1ClientsClientIdDeploymentsParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdDeploymentsResponse, error) { rsp, err := c.GetApiV1ClientsClientIdDeployments(ctx, clientId, params, reqEditors...) if err != nil { @@ -1087,7 +1470,11 @@ func (c *ClientWithResponses) GetApiV1ClientsClientIdDeploymentsWithResponse(ctx return ParseGetApiV1ClientsClientIdDeploymentsResponse(rsp) } -// PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse request with arbitrary body returning *PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse +// PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse Report deployment status +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). func (c *ClientWithResponses) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBodyWithResponse(ctx context.Context, clientId string, deploymentId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse, error) { rsp, err := c.PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithBody(ctx, clientId, deploymentId, contentType, body, reqEditors...) if err != nil { @@ -1096,6 +1483,11 @@ func (c *ClientWithResponses) PostApiV1ClientsClientIdDeploymentsDeploymentIdSta return ParsePostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse(rsp) } +// PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithResponse Report deployment status +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/clients/{clientId}/deployments/{deploymentId}/status (the `PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus` operationId). func (c *ClientWithResponses) PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusWithResponse(ctx context.Context, clientId string, deploymentId string, body PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse, error) { rsp, err := c.PostApiV1ClientsClientIdDeploymentsDeploymentIdStatus(ctx, clientId, deploymentId, body, reqEditors...) if err != nil { @@ -1104,7 +1496,13 @@ func (c *ClientWithResponses) PostApiV1ClientsClientIdDeploymentsDeploymentIdSta return ParsePostApiV1ClientsClientIdDeploymentsDeploymentIdStatusResponse(rsp) } -// GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse request returning *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse +// GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse Retrieve an individual ApplicationDeployment YAML file +// +// This endpoint is used by the client to fetch the YAML for a single ApplicationDeployment after it has processed a new State Manifest and identified a small number of new or updated deployments. This allows for highly efficient, incremental updates without needing to download the full bundle. To make individual workload retrievals race-free and cache-friendly, this endpoint is content-addressable: the digest of the expected YAML is part of the URL. This guarantees immutability of the fetched resource and prevents a time-of-check / time-of-use race where a deployment changes between manifest retrieval and content fetch. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /api/v1/clients/{clientId}/deployments/{deploymentId}/{digest} (the `GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest` operationId). func (c *ClientWithResponses) GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestWithResponse(ctx context.Context, clientId string, deploymentId string, digest string, params *GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestParams, reqEditors ...RequestEditorFn) (*GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse, error) { rsp, err := c.GetApiV1ClientsClientIdDeploymentsDeploymentIdDigest(ctx, clientId, deploymentId, digest, params, reqEditors...) if err != nil { @@ -1113,7 +1511,11 @@ func (c *ClientWithResponses) GetApiV1ClientsClientIdDeploymentsDeploymentIdDige return ParseGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse(rsp) } -// PostApiV1OnboardingWithBodyWithResponse request with arbitrary body returning *PostApiV1OnboardingResponse +// PostApiV1OnboardingWithBodyWithResponse Complete onboarding with client certificate +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). func (c *ClientWithResponses) PostApiV1OnboardingWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1OnboardingResponse, error) { rsp, err := c.PostApiV1OnboardingWithBody(ctx, contentType, body, reqEditors...) if err != nil { @@ -1122,6 +1524,11 @@ func (c *ClientWithResponses) PostApiV1OnboardingWithBodyWithResponse(ctx contex return ParsePostApiV1OnboardingResponse(rsp) } +// PostApiV1OnboardingWithResponse Complete onboarding with client certificate +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /api/v1/onboarding (the `PostApiV1Onboarding` operationId). func (c *ClientWithResponses) PostApiV1OnboardingWithResponse(ctx context.Context, body PostApiV1OnboardingJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1OnboardingResponse, error) { rsp, err := c.PostApiV1Onboarding(ctx, body, reqEditors...) if err != nil { @@ -1130,7 +1537,11 @@ func (c *ClientWithResponses) PostApiV1OnboardingWithResponse(ctx context.Contex return ParsePostApiV1OnboardingResponse(rsp) } -// GetApiV1OnboardingCertificateWithResponse request returning *GetApiV1OnboardingCertificateResponse +// GetApiV1OnboardingCertificateWithResponse Download Root CA certificate +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /api/v1/onboarding/certificate (the `GetApiV1OnboardingCertificate` operationId). func (c *ClientWithResponses) GetApiV1OnboardingCertificateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV1OnboardingCertificateResponse, error) { rsp, err := c.GetApiV1OnboardingCertificate(ctx, reqEditors...) if err != nil { @@ -1152,6 +1563,26 @@ func ParseGetApiV1ClientsClientIdBundlesDigestResponse(rsp *http.Response) (*Get HTTPResponse: rsp, } + switch { + case rsp.StatusCode == 200: + var headers GetApiV1ClientsClientIdBundlesDigestResponse200Headers + if values := rsp.Header.Values("Cache-Control"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "Cache-Control", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.CacheControl = &value + } + if values := rsp.Header.Values("ETag"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "ETag", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.ETag = &value + } + response.Headers200 = &headers + } + return response, nil } @@ -1224,6 +1655,32 @@ func ParseGetApiV1ClientsClientIdDeploymentsResponse(rsp *http.Response) (*GetAp } response.ApplicationvndMargoManifestV1JSON200 = &dest + case rsp.StatusCode == 304: + break // No content-type + + case rsp.StatusCode == 406: + break // No content-type + + } + + switch { + case rsp.StatusCode == 200: + var headers GetApiV1ClientsClientIdDeploymentsResponse200Headers + if values := rsp.Header.Values("Content-Type"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "Content-Type", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.ContentType = &value + } + if values := rsp.Header.Values("ETag"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "ETag", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.ETag = &value + } + response.Headers200 = &headers } return response, nil @@ -1266,6 +1723,43 @@ func ParseGetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse(rsp *http } response.YAML200 = &dest + case rsp.StatusCode == 404: + break // No content-type + + } + + switch { + case rsp.StatusCode == 200: + var headers GetApiV1ClientsClientIdDeploymentsDeploymentIdDigestResponse200Headers + if values := rsp.Header.Values("Cache-Control"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "Cache-Control", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.CacheControl = &value + } + if values := rsp.Header.Values("Content-Type"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "Content-Type", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.ContentType = &value + } + if values := rsp.Header.Values("ETag"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "ETag", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.ETag = &value + } + if values := rsp.Header.Values("Vary"); len(values) > 0 { + var value string + if err := runtime.BindStyledParameterWithOptions("simple", "Vary", values[0], &value, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""}); err != nil { + return nil, err + } + headers.Vary = &value + } + response.Headers200 = &headers } return response, nil diff --git a/standard/generatedCode/wfm/sbi/models.go b/standard/generatedCode/wfm/sbi/models.go index b4ec12be..3202a176 100644 --- a/standard/generatedCode/wfm/sbi/models.go +++ b/standard/generatedCode/wfm/sbi/models.go @@ -1,6 +1,6 @@ // Package sbi provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.16.3 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT. package sbi import ( @@ -9,10 +9,6 @@ import ( "github.com/oapi-codegen/runtime" ) -const ( - PayloadSignatureScopes = "PayloadSignature.Scopes" -) - // Defines values for ComponentStatusState. const ( ComponentStatusStateFailed ComponentStatusState = "failed" @@ -23,11 +19,41 @@ const ( ComponentStatusStateRemoving ComponentStatusState = "removing" ) +// Valid indicates whether the value is a known member of the ComponentStatusState enum. +func (e ComponentStatusState) Valid() bool { + switch e { + case ComponentStatusStateFailed: + return true + case ComponentStatusStateInstalled: + return true + case ComponentStatusStateInstalling: + return true + case ComponentStatusStatePending: + return true + case ComponentStatusStateRemoved: + return true + case ComponentStatusStateRemoving: + return true + default: + return false + } +} + // Defines values for DeploymentStatusManifestKind. const ( DeploymentStatusManifestKindDeploymentStatusManifest DeploymentStatusManifestKind = "DeploymentStatusManifest" ) +// Valid indicates whether the value is a known member of the DeploymentStatusManifestKind enum. +func (e DeploymentStatusManifestKind) Valid() bool { + switch e { + case DeploymentStatusManifestKindDeploymentStatusManifest: + return true + default: + return false + } +} + // Defines values for DeploymentStatusManifestStatusState. const ( DeploymentStatusManifestStatusStateFailed DeploymentStatusManifestStatusState = "failed" @@ -38,26 +64,95 @@ const ( DeploymentStatusManifestStatusStateRemoving DeploymentStatusManifestStatusState = "removing" ) +// Valid indicates whether the value is a known member of the DeploymentStatusManifestStatusState enum. +func (e DeploymentStatusManifestStatusState) Valid() bool { + switch e { + case DeploymentStatusManifestStatusStateFailed: + return true + case DeploymentStatusManifestStatusStateInstalled: + return true + case DeploymentStatusManifestStatusStateInstalling: + return true + case DeploymentStatusManifestStatusStatePending: + return true + case DeploymentStatusManifestStatusStateRemoved: + return true + case DeploymentStatusManifestStatusStateRemoving: + return true + default: + return false + } +} + // Defines values for DeviceCapabilitiesManifestKind. const ( DeviceCapabilitiesManifestKindDeviceCapabilitiesManifest DeviceCapabilitiesManifestKind = "DeviceCapabilitiesManifest" ) -// Defines values for DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture. +// Valid indicates whether the value is a known member of the DeviceCapabilitiesManifestKind enum. +func (e DeviceCapabilitiesManifestKind) Valid() bool { + switch e { + case DeviceCapabilitiesManifestKindDeviceCapabilitiesManifest: + return true + default: + return false + } +} + +// Defines values for DeviceCapabilitiesManifestPropertiesCpusArchitecture. +const ( + Amd64 DeviceCapabilitiesManifestPropertiesCpusArchitecture = "amd64" + Arm DeviceCapabilitiesManifestPropertiesCpusArchitecture = "arm" + Arm64 DeviceCapabilitiesManifestPropertiesCpusArchitecture = "arm64" +) + +// Valid indicates whether the value is a known member of the DeviceCapabilitiesManifestPropertiesCpusArchitecture enum. +func (e DeviceCapabilitiesManifestPropertiesCpusArchitecture) Valid() bool { + switch e { + case Amd64: + return true + case Arm: + return true + case Arm64: + return true + default: + return false + } +} + +// Defines values for DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes. const ( - Amd64 DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture = "amd64" - Arm DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture = "arm" - Arm64 DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture = "arm64" + DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesCompose DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes = "compose" + DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesHelm DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes = "helm" ) -// Defines values for DeviceCapabilitiesManifestPropertiesRoles. +// Valid indicates whether the value is a known member of the DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes enum. +func (e DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes) Valid() bool { + switch e { + case DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesCompose: + return true + case DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypesHelm: + return true + default: + return false + } +} + +// Defines values for DeviceCapabilitiesManifestPropertiesSupportedRuntimes. const ( - ClusterLeader DeviceCapabilitiesManifestPropertiesRoles = "Cluster Leader" - Gateway DeviceCapabilitiesManifestPropertiesRoles = "Gateway" - StandaloneCluster DeviceCapabilitiesManifestPropertiesRoles = "Standalone Cluster" - StandaloneDevice DeviceCapabilitiesManifestPropertiesRoles = "Standalone Device" + Oci DeviceCapabilitiesManifestPropertiesSupportedRuntimes = "oci" ) +// Valid indicates whether the value is a known member of the DeviceCapabilitiesManifestPropertiesSupportedRuntimes enum. +func (e DeviceCapabilitiesManifestPropertiesSupportedRuntimes) Valid() bool { + switch e { + case Oci: + return true + default: + return false + } +} + // Defines values for DeviceCommunicationInterfaceType. const ( Bluetooth DeviceCommunicationInterfaceType = "bluetooth" @@ -69,6 +164,28 @@ const ( Wifi DeviceCommunicationInterfaceType = "wifi" ) +// Valid indicates whether the value is a known member of the DeviceCommunicationInterfaceType enum. +func (e DeviceCommunicationInterfaceType) Valid() bool { + switch e { + case Bluetooth: + return true + case Canbus: + return true + case Cellular: + return true + case Ethernet: + return true + case Rs232: + return true + case Usb: + return true + case Wifi: + return true + default: + return false + } +} + // Defines values for DevicePeripheralType. const ( Camera DevicePeripheralType = "camera" @@ -78,17 +195,57 @@ const ( Speaker DevicePeripheralType = "speaker" ) +// Valid indicates whether the value is a known member of the DevicePeripheralType enum. +func (e DevicePeripheralType) Valid() bool { + switch e { + case Camera: + return true + case Display: + return true + case Gpu: + return true + case Microphone: + return true + case Speaker: + return true + default: + return false + } +} + // Defines values for AppDeploymentProfileType. const ( - Compose AppDeploymentProfileType = "compose" - Helm AppDeploymentProfileType = "helm" + AppDeploymentProfileTypeCompose AppDeploymentProfileType = "compose" + AppDeploymentProfileTypeHelm AppDeploymentProfileType = "helm" ) +// Valid indicates whether the value is a known member of the AppDeploymentProfileType enum. +func (e AppDeploymentProfileType) Valid() bool { + switch e { + case AppDeploymentProfileTypeCompose: + return true + case AppDeploymentProfileTypeHelm: + return true + default: + return false + } +} + // Defines values for PostApiV1OnboardingJSONBodyKind. const ( OnboardingRequest PostApiV1OnboardingJSONBodyKind = "OnboardingRequest" ) +// Valid indicates whether the value is a known member of the PostApiV1OnboardingJSONBodyKind enum. +func (e PostApiV1OnboardingJSONBodyKind) Valid() bool { + switch e { + case OnboardingRequest: + return true + default: + return false + } +} + // ComponentStatus defines model for ComponentStatus. type ComponentStatus struct { Error *struct { @@ -161,32 +318,35 @@ type DeviceCapabilitiesManifest struct { ApiVersion string `json:"apiVersion"` Kind DeviceCapabilitiesManifestKind `json:"kind"` Properties struct { - Id DeviceId `json:"id"` - ModelNumber string `json:"modelNumber"` - Resources *struct { - Cpu struct { - Architecture *DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture `json:"architecture,omitempty"` - Cores float32 `json:"cores"` - } `json:"cpu"` - Interfaces []DeviceCommunicationInterface `json:"interfaces"` - Memory string `json:"memory"` - Peripherals []DevicePeripheral `json:"peripherals"` - Storage string `json:"storage"` - } `json:"resources,omitempty"` - Roles []DeviceCapabilitiesManifestPropertiesRoles `json:"roles"` - SerialNumber string `json:"serialNumber"` - Vendor string `json:"vendor"` + Cpus *[]struct { + Architecture *DeviceCapabilitiesManifestPropertiesCpusArchitecture `json:"architecture,omitempty"` + Cores float32 `json:"cores"` + } `json:"cpus,omitempty"` + Id DeviceId `json:"id"` + Interfaces *[]DeviceCommunicationInterface `json:"interfaces,omitempty"` + Memory *string `json:"memory,omitempty"` + ModelNumber string `json:"modelNumber"` + OtelCollector *bool `json:"otelCollector,omitempty"` + Peripherals *[]DevicePeripheral `json:"peripherals,omitempty"` + SerialNumber string `json:"serialNumber"` + Storage *string `json:"storage,omitempty"` + SupportedDeploymentTypes *[]DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes `json:"supportedDeploymentTypes,omitempty"` + SupportedRuntimes *[]DeviceCapabilitiesManifestPropertiesSupportedRuntimes `json:"supportedRuntimes,omitempty"` + Vendor string `json:"vendor"` } `json:"properties"` } // DeviceCapabilitiesManifestKind defines model for DeviceCapabilitiesManifest.Kind. type DeviceCapabilitiesManifestKind string -// DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture defines model for DeviceCapabilitiesManifest.Properties.Resources.Cpu.Architecture. -type DeviceCapabilitiesManifestPropertiesResourcesCpuArchitecture string +// DeviceCapabilitiesManifestPropertiesCpusArchitecture defines model for DeviceCapabilitiesManifest.Properties.Cpus.Architecture. +type DeviceCapabilitiesManifestPropertiesCpusArchitecture string + +// DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes defines model for DeviceCapabilitiesManifest.Properties.SupportedDeploymentTypes. +type DeviceCapabilitiesManifestPropertiesSupportedDeploymentTypes string -// DeviceCapabilitiesManifestPropertiesRoles defines model for DeviceCapabilitiesManifest.Properties.Roles. -type DeviceCapabilitiesManifestPropertiesRoles string +// DeviceCapabilitiesManifestPropertiesSupportedRuntimes defines model for DeviceCapabilitiesManifest.Properties.SupportedRuntimes. +type DeviceCapabilitiesManifestPropertiesSupportedRuntimes string // DeviceCommunicationInterface defines model for DeviceCommunicationInterface. type DeviceCommunicationInterface struct { @@ -245,6 +405,7 @@ type AppDeploymentManifest struct { // AppDeploymentMetadata defines model for appDeploymentMetadata. type AppDeploymentMetadata struct { + // DeviceId Device ID of the target device for the deployment DeviceId DeviceIdWithAsterisk `json:"deviceId"` // Labels Labels for the resource @@ -282,10 +443,10 @@ type AppDeploymentSpec struct { // ApplicationId An identifier for the application. The id is used to help create unique identifiers where required, such as namespaces. The id must be lower case letters and numbers and MAY contain dashes. Uppercase letters, underscores and periods MUST NOT be used. The id MUST NOT be more than 200 characters. The applicationId MUST match the associated application description's top-level "id" attribute. ApplicationId string `json:"applicationId"` - // DeploymentProfile Application Deployment Profile + // DeploymentProfile Deployment profile DeploymentProfile AppDeploymentProfile `json:"deploymentProfile"` - // Parameters Application Parameters + // Parameters Parameters for the deployment Parameters *AppDeploymentParams `json:"parameters,omitempty"` } @@ -417,7 +578,7 @@ func (t *AppDeploymentProfile_Components_Item) MergeHelmApplicationDeploymentPro return err } - merged, err := runtime.JsonMerge(t.union, b) + merged, err := runtime.JSONMerge(t.union, b) t.union = merged return err } @@ -443,7 +604,7 @@ func (t *AppDeploymentProfile_Components_Item) MergeComposeApplicationDeployment return err } - merged, err := runtime.JsonMerge(t.union, b) + merged, err := runtime.JSONMerge(t.union, b) t.union = merged return err } diff --git a/standard/snapshot.spec.yaml b/standard/snapshot.spec.yaml index 829889d9..a3a0057e 100644 --- a/standard/snapshot.spec.yaml +++ b/standard/snapshot.spec.yaml @@ -1,7 +1,7 @@ -openapi: 3.0.3 +openapi: 3.1.0 info: title: Margo Workload Management API - version: 1.0.0 + version: 1.0.0-rc.2 description: API for managing workloads on Margo-compliant edge devices. Includes the APIs for exchanging desired state and current state. @@ -10,7 +10,7 @@ info: servers: - url: https://wfm.margo.org/ - description: Workload Fleet Manager API + description: Workload Fleet Manager APIs security: - PayloadSignature: [] @@ -403,8 +403,7 @@ components: Monotonically increasing unsigned 64-bit integer in the inclusive range [1, 2^64-1]. Prevents rollback attacks. The first manifest MUST use 1. DeploymentBundleRef: - type: object - nullable: true + type: [object, 'null'] description: > Describes a single archive containing all ApplicationDeployment documents. If there are zero deployments (deployments array is empty) the property MUST be present with the value null (it MUST NOT be omitted). properties: @@ -471,6 +470,13 @@ components: DeviceCapabilitiesManifest: type: object required: [apiVersion, kind, properties] + patternProperties: + '^x-[a-z][a-z0-9-]*-extensions$': + type: object + description: >- + Vendor-specific extension. Keys MUST match x--extensions + where matches [a-z][a-z0-9-]*. + additionalProperties: false properties: apiVersion: type: string @@ -479,7 +485,13 @@ components: enum: [DeviceCapabilitiesManifest] properties: type: object - required: [id, vendor, modelNumber, serialNumber, roles] + required: [id, vendor, modelNumber, serialNumber] + # Only identity fields are required. A device that hosts workloads reports cpus, memory, + # storage, peripherals, interfaces, otelCollector (true), supportedRuntimes (>=1), and + # supportedDeploymentTypes (>=1). A device that does not host workloads (e.g. a see-thru + # gateway that only relays the devices behind it) omits those fields. + # The WFM infers it is non-hosting from their absence and infers a + # gateway from the parent/child deviceId hierarchy. properties: id: $ref: '#/components/schemas/DeviceId' @@ -489,36 +501,43 @@ components: type: string serialNumber: type: string - roles: + cpus: + type: array + items: + type: object + required: [cores] + properties: + cores: + type: number + architecture: + type: string + enum: [amd64, arm64, arm] + memory: + type: string + storage: + type: string + peripherals: + type: array + items: + $ref: '#/components/schemas/DevicePeripheral' + interfaces: + type: array + items: + $ref: '#/components/schemas/DeviceCommunicationInterface' + otelCollector: + type: boolean + supportedRuntimes: type: array + minItems: 1 items: type: string - enum: [Standalone Cluster, Cluster Leader, Standalone Device, Gateway] - resources: - type: object - required: [cpu, memory, storage, peripherals, interfaces] - properties: - cpu: - type: object - required: [cores] - properties: - cores: - type: number - architecture: - type: string - enum: [amd64, arm64, arm] - memory: - type: string - storage: - type: string - peripherals: - type: array - items: - $ref: '#/components/schemas/DevicePeripheral' - interfaces: - type: array - items: - $ref: '#/components/schemas/DeviceCommunicationInterface' + enum: [oci] + supportedDeploymentTypes: + type: array + minItems: 1 + items: + type: string + enum: [helm, compose] DeviceId: # format: "{id}[/{id}[/{id}...]]" # Top-level id is required and must include only unreserved characters as specified in RFC3986. @@ -648,6 +667,13 @@ components: type: object description: Helm Application Deployment Profile Component required: [name, properties] + patternProperties: + '^x-[a-z][a-z0-9-]*-extensions$': + type: object + description: >- + Vendor-specific extension. Keys MUST match x--extensions + where matches [a-z][a-z0-9-]*. + additionalProperties: false properties: name: type: string @@ -672,6 +698,13 @@ components: type: object description: Compose Application Deployment Profile Component required: [name, properties] + patternProperties: + '^x-[a-z][a-z0-9-]*-extensions$': + type: object + description: >- + Vendor-specific extension. Keys MUST match x--extensions + where matches [a-z][a-z0-9-]*. + additionalProperties: false properties: name: type: string @@ -696,6 +729,13 @@ components: type: object description: Application Deployment Profile required: [type, components] + patternProperties: + '^x-[a-z][a-z0-9-]*-extensions$': + type: object + description: >- + Vendor-specific extension. Keys MUST match x--extensions + where matches [a-z][a-z0-9-]*. + additionalProperties: false properties: type: type: string @@ -745,6 +785,13 @@ components: type: object description: Application Deployment specification required: [applicationId, deploymentProfile] + patternProperties: + '^x-[a-z][a-z0-9-]*-extensions$': + type: object + description: >- + Vendor-specific extension. Keys MUST match x--extensions + where matches [a-z][a-z0-9-]*. + additionalProperties: false properties: applicationId: type: string