Skip to content

Commit

Permalink
Adding ApplicationGraphResource model API TypeSpec (#6425)
Browse files Browse the repository at this point in the history
# Description

Update ApplicationGraphResource model 
- to be able to support for pagination
- to include ApplicationGraphOutputResource
 

## Type of change

- This pull request adds or changes features of Radius and has an
approved issue (issue link required).

Partially Fixes:
#[6337](#6337)

## Auto-generated summary

<!--
GitHub Copilot for docs will auto-generate a summary of the PR
-->

<!--
copilot:all
-->
### <samp>🤖 Generated by Copilot at ad299e2</samp>

### Summary
📊🌐🛠️

<!--
1. 📊 - This emoji represents the new feature of getting the application
graph and resources, which is a visual and analytical tool for users to
understand the architecture and dependencies of their application
resource.
2. 🌐 - This emoji represents the new models and types that describe the
resources and connections in the application graph, which are
network-related concepts that show how the components of the application
interact with each other and with external resources.
3. 🛠️ - This emoji represents the new functions and methods that
implement the serialization and deserialization of the graph objects, as
well as the creation and handling of the request and response for the
new operation, which are technical and functional aspects of the code
change.
-->
This pull request adds a new feature to the Applications.Core resource
provider that allows users to query the application graph and resources
of an application resource. It updates the `openapi.json` specification
and the `applications.tsp` file to document the new feature and models.
It also generates new types, methods, and functions in the
`v20231001preview` package to implement the feature and handle the
request and response. Additionally, it fixes a test failure by changing
the API version in the `corerp-resources-application.bicep` file.

> _We are the masters of the graph, we see the connections of the core_
> _We send the post request to the endpoint, we get the response with
the `ApplicationGraphResponse`_
> _We marshal and unmarshal the JSON, we use the
`ApplicationsClientGetGraphOptions`_
> _We are the masters of the graph, we rule the `v20231001preview`_

### Walkthrough
* Add a new feature to query the application graph and resources of an
application resource
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-09b86d89a837246f3822cca8ee43e4a308f6b4c529c30754e84846d2af008e52R198-R253),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R311-R360),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-b8dc4ae8a464360dbbf745e5af8f383d89a314c1958792a8adf3dc6f82e9d823R154-R162))
- Implement a new method `GetGraph` in the `ApplicationsClient` struct
that sends a POST request to the `/getGraph` endpoint and returns an
`ApplicationGraphResponse` struct
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-09b86d89a837246f3822cca8ee43e4a308f6b4c529c30754e84846d2af008e52R198-R253))
- Document the new operation in the `openapi.json` specification with
the path parameters, the request body, and the response body
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R311-R360))
- Define a new action `getGraph` in the
`typespec/Applications.Core/applications.tsp` file with the input and
output parameters and the documentation
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-b8dc4ae8a464360dbbf745e5af8f383d89a314c1958792a8adf3dc6f82e9d823R154-R162))
* Define new models for the resources and connections in the application
graph
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR12-R56),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R2522-R2624),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-b8dc4ae8a464360dbbf745e5af8f383d89a314c1958792a8adf3dc6f82e9d823R67-R123))
- Add new types `ApplicationGraphConnection`,
`ApplicationGraphOutputResource`, `ApplicationGraphResource`, and
`ApplicationGraphResponse` to the `v20231001preview` package and the
`openapi.json` specification
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR12-R56),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R2522-R2624))
- Add new type `Direction` to the `v20231001preview` package and the
`openapi.json` specification as a string enum for the connection
direction
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-07cd8284519deaa5e625f1fe393cb48bdd1cc621c9a4656ca43cc6049dfe7962R106-R123),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R3332-R3355))
- Add new types `ApplicationGraphResponse`,
`ApplicationGraphConnection`, `Direction`, `ApplicationGraphResource`,
and `ApplicationGraphOutputResource` to the
`typespec/Applications.Core/applications.tsp` file with the
documentation and the extensions
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-b8dc4ae8a464360dbbf745e5af8f383d89a314c1958792a8adf3dc6f82e9d823R67-R123))
* Enable the encoding and decoding of the new models as JSON objects
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R17-R152))
- Add new functions `MarshalJSON` and `UnmarshalJSON` to the types
`ApplicationGraphConnection`, `ApplicationGraphOutputResource`,
`ApplicationGraphResource`, and `ApplicationGraphResponse` in the
`v20231001preview` package
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R17-R152))
* Provide placeholders for future optional parameters and response types
for the `GetGraph` method
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-e40562ef9d9abc12ef551ab7651a5f8b079b6b88a55c13e8b66792e8509b7503R20-R24),
[link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-d3bed90c8d082ba05ab113150f5afa6c51cabd0db1523e00da63e4f11d54692aR21-R26))
- Add new type `ApplicationsClientGetGraphOptions` to the
`v20231001preview` package as a struct for the optional parameters
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-e40562ef9d9abc12ef551ab7651a5f8b079b6b88a55c13e8b66792e8509b7503R20-R24))
- Add new type `ApplicationsClientGetGraphResponse` to the
`v20231001preview` package as a struct for the response that embeds the
`ApplicationGraphResponse` struct
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-d3bed90c8d082ba05ab113150f5afa6c51cabd0db1523e00da63e4f11d54692aR21-R26))
* Fix a test failure due to the mismatch between the API versions in the
bicep file and the `openapi.json` specification
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-c93997d341207e085433657b16d3435da09e63c442e5b2ec35e06362684673a8L9-R9))
- Update the
`test/functional/shared/resources/testdata/corerp-resources-application.bicep`
file to use the `2022-03-15-privatepreview` API version instead of the
`2023-10-01-preview` API version for the application resource
([link](https://github.com/radius-project/radius/pull/6425/files?diff=unified&w=0#diff-c93997d341207e085433657b16d3435da09e63c442e5b2ec35e06362684673a8L9-R9))
  • Loading branch information
nithyatsu authored Oct 4, 2023
1 parent 1a7a898 commit 4a469cf
Show file tree
Hide file tree
Showing 8 changed files with 511 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions pkg/corerp/api/v20231001preview/zz_generated_constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions pkg/corerp/api/v20231001preview/zz_generated_models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions pkg/corerp/api/v20231001preview/zz_generated_models_serde.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/corerp/api/v20231001preview/zz_generated_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a469cf

Please sign in to comment.