Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(drs): add autogenerated models #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lilachic
Copy link
Contributor

@lilachic lilachic commented Nov 8, 2024

Fixes https://github.com/orgs/elixir-cloud-aai/projects/23/views/1?filterQuery=&pane=issue&itemId=85797382&issue=elixir-cloud-aai%7Cga4gh-sdk%7C55 .

Added: lib/src/clients/drs
Added: lib/src/clients/drs/mod.rs
Modified: ./lib/src/clients/mod.rs to containd drs module.
Autogenerated: lib/src/clients/drs/models/*.rs

Summary by Sourcery

New Features:

  • Introduce a new Data Repository Service (DRS) client module with autogenerated models.

Copy link
Contributor

sourcery-ai bot commented Nov 8, 2024

Reviewer's Guide by Sourcery

This PR adds autogenerated DRS (Data Repository Service) client models to the codebase. The models are generated from the OpenAPI specification version 1.4.0 and include all necessary data structures for interacting with a DRS service. The implementation follows Rust's standard practices for serializable data models using serde.

Class diagram for the new DRS models

classDiagram
    class DrsObject {
        +String id
        +Option<String> name
        +String self_uri
        +i64 size
        +String created_time
        +Option<String> updated_time
        +Option<String> version
        +Option<String> mime_type
        +Vec<Checksum> checksums
        +Option<Vec<AccessMethod>> access_methods
        +Option<Vec<ContentsObject>> contents
        +Option<String> description
        +Option<Vec<String>> aliases
        +new(String id, String self_uri, i64 size, String created_time, Vec<Checksum> checksums)
    }

    class AccessMethod {
        +Type type
        +Option<Box<AccessMethodAccessUrl>> access_url
        +Option<String> access_id
        +Option<String> region
        +Option<bool> available
        +Option<Box<AccessMethodAuthorizations>> authorizations
        +new(Type type)
    }

    class GetServiceInfo200Response {
        +String id
        +String name
        +Box<DrsServiceType> type
        +Option<String> description
        +Box<ServiceOrganization> organization
        +Option<String> contact_url
        +Option<String> documentation_url
        +Option<String> created_at
        +Option<String> updated_at
        +Option<String> environment
        +String version
        +i32 max_bulk_request_length
        +new(String id, String name, DrsServiceType type, ServiceOrganization organization, String version, i32 max_bulk_request_length)
    }

    class Service {
        +String id
        +String name
        +Box<ServiceType> type
        +Option<String> description
        +Box<ServiceOrganization> organization
        +Option<String> contact_url
        +Option<String> documentation_url
        +Option<String> created_at
        +Option<String> updated_at
        +Option<String> environment
        +String version
        +new(String id, String name, ServiceType type, ServiceOrganization organization, String version)
    }

    class AccessMethodAuthorizations {
        +Option<String> drs_object_id
        +Option<Vec<SupportedTypes>> supported_types
        +Option<Vec<String>> passport_auth_issuers
        +Option<Vec<String>> bearer_auth_issuers
        +new()
    }

    class Authorizations {
        +Option<String> drs_object_id
        +Option<Vec<SupportedTypes>> supported_types
        +Option<Vec<String>> passport_auth_issuers
        +Option<Vec<String>> bearer_auth_issuers
        +new()
    }

    class BulkAccessUrl {
        +Option<String> drs_object_id
        +Option<String> drs_access_id
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class ServiceOrganization {
        +String name
        +String url
        +new(String name, String url)
    }

    class Checksum {
        +String checksum
        +String type
        +new(String checksum, String type)
    }

    class AccessMethodAccessUrl {
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class AccessUrl {
        +String url
        +Option<Vec<String>> headers
        +new(String url)
    }

    class ContentsObject {
        +String name
        +Option<String> id
        +Option<Vec<String>> drs_uri
        +Option<Vec<ContentsObject>> contents
        +new(String name)
    }

    class DrsServiceType {
        +Artifact artifact
        +new(Artifact artifact)
    }

    class ServiceType {
        +String group
        +String artifact
        +String version
        +new(String group, String artifact, String version)
    }

    class Summary {
        +Option<i32> requested
        +Option<i32> resolved
        +Option<i32> unresolved
        +new()
    }

    class Error {
        +Option<String> msg
        +Option<i32> status_code
        +new()
    }

    class GetBulkAccessUrl200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<BulkAccessUrl>> resolved_drs_object_access_urls
        +new()
    }

    class GetBulkObjects200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<DrsObject>> resolved_drs_object
        +new()
    }

    class OptionsBulkObject200Response {
        +Option<Box<Summary>> summary
        +Option<Vec<UnresolvedInner>> unresolved_drs_objects
        +Option<Vec<Authorizations>> resolved_drs_object
        +new()
    }

    class UnresolvedInner {
        +Option<i32> error_code
        +Option<Vec<String>> object_ids
        +new()
    }

    class PostAccessUrlRequest {
        +Option<Vec<String>> passports
        +new()
    }

    class PostObjectRequest {
        +Option<bool> expand
        +Option<Vec<String>> passports
        +new()
    }

    class DrsService {
        +i32 max_bulk_request_length
        +Box<DrsServiceType> type
        +new(i32 max_bulk_request_length, DrsServiceType type)
    }

    class DrsServiceType {
        +Artifact artifact
        +new(Artifact artifact)
    }

    class Artifact {
        <<enumeration>>
        Drs
    }

    class SupportedTypes {
        <<enumeration>>
        None
        BasicAuth
        BearerAuth
        PassportAuth
    }

    class Type {
        <<enumeration>>
        S3
        Gs
        Ftp
        Gsiftp
        Globus
        Htsget
        Https
        File
    }
Loading

File-Level Changes

Change Details Files
Added new DRS client module with autogenerated models
  • Created new DRS module directory structure
  • Added DRS module to the clients module exports
  • Generated model structs for DRS objects and services
  • Implemented serialization/deserialization using serde
lib/src/clients/mod.rs
lib/src/clients/drs/mod.rs
lib/src/clients/drs/models/mod.rs
Implemented core DRS data models
  • Added DrsObject model for representing DRS resources
  • Created AccessMethod model for handling different access types
  • Implemented Checksum model for data integrity verification
  • Added ServiceInfo models for DRS service metadata
lib/src/clients/drs/models/drs_object.rs
lib/src/clients/drs/models/access_method.rs
lib/src/clients/drs/models/checksum.rs
lib/src/clients/drs/models/get_service_info_200_response.rs
Added support models for DRS operations
  • Implemented models for bulk operations
  • Added error handling models
  • Created authorization-related models
  • Added request/response models for various DRS endpoints
lib/src/clients/drs/models/bulk_access_url.rs
lib/src/clients/drs/models/error.rs
lib/src/clients/drs/models/authorizations.rs
lib/src/clients/drs/models/post_access_url_request.rs
lib/src/clients/drs/models/post_object_request.rs

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lilachic - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding documentation comments explaining what DRS (Data Repository Service) is and how these models are auto-generated from the OpenAPI spec. This would help future contributors understand the context and purpose of this code.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@uniqueg uniqueg removed their request for review December 18, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant