corerp/

directory
v0.42.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: Apache-2.0

README

Applications.Core RP

WIP - This doc will be updated iteratively.

Layout

  1. /pkg/corerp/api: API version specific models
  2. /pkg/corerp/datamodel: API version agnostic models to implement operation controller and store resource metadata.
  3. /pkg/corerp/frontend/controller: Per-operation controller implementations.
  4. /pkg/corerp/frontend/handler: HTTP server handler and routers.
  5. /pkg/corerp/frontend/middleware: HTTP server middleware.
  6. /pkg/corerp/frontend/hostingoptions: Hosting options for resource provider service.
  7. /pkg/corerp/frontend/servicecontext: Service context extracted from ARM proxy request header.

Add new resource type and its controller

  1. Ensure that you update openapi spec in /swagger
  2. Generate resource type models in /pkg/corerp/api by following the instruction.
  3. Define api version agnostic datamodel in /pkg/corerp/datamodel and its converters between datamodel and api models.
  4. Define routes for new resource type and its operation APIs in routes.go.
  5. Create resource type directory under /pkg/frontend/controller/ and related go files by referring to environments controller.
  6. Implement operation controllers and tests.
  7. Register handlers in handlers.go.

How to Run and Test Core RP

  1. With cmd/applications-rp/main.go file open, go to Run And Debug view in VS Code and click Run

  2. You should have the service up and running at localhost:8080 now

  3. To create or update an environment, here is an example curl command:

    curl --location --request PUT 'http://localhost:8080/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0?api-version=2023-10-01-preview' \
    --header 'X-Ms-Arm-Resource-System-Data: {"lastModifiedBy":"fake@hotmail.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-22T18:54:52.6857175Z"}' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "properties": {
            "compute": {
                "kind": "Kubernetes",
                "resourceId": "test-override-2"
            }
        }
    }'
    
  4. To get information about an environment, here is an example curl command:

    curl --location --request GET 'http://localhost:8080/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/?api-version=2023-10-01-preview'
    

References

Directories

Path Synopsis
api
backend
deployment
Package deployment is a generated GoMock package.
Package deployment is a generated GoMock package.
frontend
Package handlers is a generated GoMock package.
Package handlers is a generated GoMock package.
processors
extenders
extenders contains the resource processor for extenders.
extenders contains the resource processor for extenders.
Package renderers is a generated GoMock package.
Package renderers is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL